public class InOut
extends java.lang.Object
Constructor and Description |
---|
InOut() |
Modifier and Type | Method and Description |
---|---|
static void |
appendnlString(java.lang.String line,
java.lang.String file)
Writes a string to file, appends to an existing file, creates a new file
otherwise prints an error message to StdOut in case of I/O error
|
static java.lang.String |
asterisks(int n)
Generates a string of * of specified length
|
static void |
printErrorMsg(java.lang.String msg)
Prints to StdOut a visible message
|
static java.lang.String |
readFileToString(java.lang.String stringFile)
Reads the whole file to a string; lines are separated by \n prints an
error message to StdOut in case of I/O error
|
static java.lang.String |
readString(java.lang.String stringFile)
Reads the first line of a file to a string, prints an error message to
StdOut in case of I/O error
|
static java.lang.String[] |
readStringArray(java.lang.String stringFile)
Reads the whole file to an array of strings: one string per line prints
an error message to StdOut in case of I/O error
|
static void |
writeStringToFile(java.lang.String line,
java.lang.String file)
Writes a string to file, overwrites the file prints an error message to
StdOut in case of I/O error
|
public static java.lang.String readString(java.lang.String stringFile)
stringFile
- filenamepublic static java.lang.String readFileToString(java.lang.String stringFile)
stringFile
- the filenamepublic static java.lang.String[] readStringArray(java.lang.String stringFile)
stringFile
- the filenamepublic static void writeStringToFile(java.lang.String line, java.lang.String file)
line
- string to be writtenfile
- filenamepublic static void appendnlString(java.lang.String line, java.lang.String file)
line
- string to be writtenfile
- filenamepublic static java.lang.String asterisks(int n)
n
- length of the stringpublic static void printErrorMsg(java.lang.String msg)
msg
- the message to be prnted