cac_tool
Class ReadWrite

java.lang.Object
  |
  +--cac_tool.ReadWrite

public class ReadWrite
extends java.lang.Object

The ReadWrite class is able to read form file or url and to write a string to a file.

Version:
1.0
Author:
Christian Schrumpf, Stefan Meißner

Constructor Summary
ReadWrite()
          Initializes a newly created ReadWrite object.
ReadWrite(CacTool cac)
          Initializes a ReadWrite object with reference to CacTool
 
Method Summary
 java.lang.StringBuffer getContent()
          Gets the content of the StringBuffer
 int getLineCount()
          Gets the number of lines the file contains
 java.lang.StringBuffer getURLContent(java.lang.String link)
          Reads the content out a of file or URL
 void writeToFile(java.io.File file, java.lang.String sb1)
          Writes the string to the specified file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadWrite

public ReadWrite()
Initializes a newly created ReadWrite object.


ReadWrite

public ReadWrite(CacTool cac)
Initializes a ReadWrite object with reference to CacTool

Parameters:
cac - reference to CacTool
Method Detail

getURLContent

public java.lang.StringBuffer getURLContent(java.lang.String link)
Reads the content out a of file or URL

Parameters:
link - the URL of file to open
Returns:
a StringBuffer with the content of the file or URL

getLineCount

public int getLineCount()
Gets the number of lines the file contains

Returns:
lineCount a int value of the lines in the file

getContent

public java.lang.StringBuffer getContent()
Gets the content of the StringBuffer

Returns:
a StringBuffer with file content

writeToFile

public void writeToFile(java.io.File file,
                        java.lang.String sb1)
Writes the string to the specified file

Parameters:
file - name of the file
sb1 - a string to save in file