|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
astex.FILE
public class FILE
A class which implements a high performance byte based input stream. Buffering is performed internally. This class is NOT thread safe.
| Field Summary | |
|---|---|
static int |
EOF
The constant that represents the end of file. |
static FILE |
err
|
static FILE |
in
|
static int |
MAC
|
static FILE |
out
Wrapper allowing write to stdout and stderr. |
static int |
PC
|
static FILE |
spr
|
static int |
UNIX
|
| Constructor Summary | |
|---|---|
FILE(java.io.InputStream is)
Constructor that will take an InputStream and create a FILE object that will read from it. |
|
FILE(java.io.OutputStream os)
Constructor for stdout stderr output. |
|
| Method Summary | |
|---|---|
void |
close()
Close a file object. |
boolean |
currentLineContains(java.lang.String string,
int offset)
Does the current line contain the specified string at the specified location. |
void |
format(char c)
Format the char argument. |
void |
format(double x)
Format double. |
void |
format(long d)
Format integer. |
void |
format(java.lang.String s)
Format the String argument. |
char |
getChar(int offset)
Return the specified character from the current line. |
java.lang.String |
getCurrentLineAsString()
Return the current line as a String. |
double |
getDouble(int f)
Synonym for readDoubleFromField. |
static java.lang.Exception |
getException()
Get the exception (if any) that was thrown when FILE.open() was called. |
java.lang.String |
getField(int f)
Get the field as a string. |
byte |
getFieldChar(int f,
int c)
Get the specified character from the field. |
int |
getFieldCount()
Return the number of fields on the current line. |
int |
getFieldLength(int f)
Get the start position of the field. |
int |
getFieldStart(int f)
Get the start position of the field. |
float |
getFloat(int f)
|
java.io.InputStream |
getInputStream()
Get the input stream associated with this file. |
int |
getInteger(int f)
Synonym for readIntegerFromField. |
int |
getLineLength()
Return the length of the current line. |
static java.lang.String |
getRelativePath(java.lang.String path)
Try and make path relative to current directory. |
java.lang.String |
getSubstring(int offset,
int length)
Return a substring of the current line. |
static boolean |
getTryFiles()
|
static java.util.Properties |
loadProperties(java.lang.String resource)
Convenience method to load a properties file. |
static void |
main(java.lang.String[] args)
Test program for the FILE class. |
boolean |
nextLine()
Advance the FILE object to the next line. |
static FILE |
open(java.io.File file)
Create a FILE object to read from the specified File object. |
static FILE |
open(java.lang.String resource)
Return a FILE object for reading the specified resource. |
static FILE |
open(java.net.URL url)
Create a FILE object to read from the specified URL. |
static FILE |
openFile(java.lang.String filename)
Create a FILE object to read from the specified filename. |
static FILE |
openURL(java.lang.String urlname)
Create a FILE object to read from the specified urlname. |
void |
print(char c)
Print a char. |
void |
print(int w,
int p,
double d)
Quick print function for floats/doubles. |
void |
print(int w,
long d)
Quick print function for ints/long |
void |
print(java.lang.String s)
print function. |
void |
print(java.lang.String f,
char c)
Print a formatted char. |
void |
print(java.lang.String f,
double d)
Print a formatted double. |
void |
print(java.lang.String f,
double d1,
double d2,
double d3)
Print function for 3 floats/doubles. |
void |
print(java.lang.String f,
long d)
Print a formatted integer. |
void |
print(java.lang.String f,
long d1,
long d2,
long d3)
Print function for 3 ints/longs. |
void |
print(java.lang.String f,
java.lang.String s)
Print a formatted String. |
void |
println(java.lang.String s)
println function. |
int |
read()
Read a single character. |
double |
readDouble(int offset,
int length)
Read a double precision number from the specified region. |
static double |
readDouble(java.lang.String string)
Read a double value from a string. |
double |
readDoubleFromField(int f)
Read a double from the specified field. |
static int |
readFrom(FILE file)
Read the data from the specified FILE object. |
int |
readInteger(int offset,
int length)
Read an integer from the current line buffer. |
static int |
readInteger(java.lang.String string)
Read an integer from the specified string. |
int |
readInteger3(int offset)
Specific method for reading a 3 column integer. |
int |
readIntegerFromField(int f)
Read an integer from the specified field. |
java.lang.String |
readLine()
Provide a method that will return the current line as a String. |
void |
setautoFlush(boolean f)
sets the autoFlush flag. |
void |
setCharactersInBuffer(int i)
|
static void |
setCodeBase(java.net.URL url)
Set the docuemnt base. |
static void |
setDebug(boolean state)
Set the debug state. |
static void |
setDocumentBase(java.net.URL url)
Set the docuemnt base. |
void |
setEolIdentifier(int opsys)
Set the eond of line characters explicitily. |
void |
setOutputStream(java.io.OutputStream os)
Set the output stream. |
static void |
setTryFiles(boolean t)
|
int |
skip(int byteCount)
Skip some bytes. |
static java.lang.String[] |
split(java.lang.String string)
Convenience methods for splitting strings into fields. |
static java.lang.String[] |
split(java.lang.String string,
java.lang.String separators)
Convenience methods for splitting strings into fields. |
static java.lang.String |
sprint(java.lang.String f,
double d)
Return a formatted double as String. |
static java.lang.String |
sprint(java.lang.String f,
long d)
Return a formatted long as String. |
static java.lang.String |
sprint(java.lang.String f,
java.lang.String d)
Return a formatted String as String. |
static boolean |
stringIsURL(java.lang.String resource)
Does the resource look like it is a URL? |
void |
ungetc(int c)
unget a single character. |
static FILE |
write(java.lang.String file)
Opens outputstream for writing. |
| Methods inherited from class java.io.InputStream |
|---|
available, mark, markSupported, read, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int EOF
public static FILE out
public static FILE err
public static FILE in
public static FILE spr
public static final int UNIX
public static final int PC
public static final int MAC
| Constructor Detail |
|---|
public FILE(java.io.OutputStream os)
public FILE(java.io.InputStream is)
| Method Detail |
|---|
public void setautoFlush(boolean f)
public static java.lang.String sprint(java.lang.String f,
double d)
public static java.lang.String sprint(java.lang.String f,
long d)
public static java.lang.String sprint(java.lang.String f,
java.lang.String d)
public void print(char c)
public void print(int w,
int p,
double d)
public void print(int w,
long d)
public void print(java.lang.String f,
double d1,
double d2,
double d3)
public void print(java.lang.String f,
long d1,
long d2,
long d3)
public void print(java.lang.String s)
public void println(java.lang.String s)
public void print(java.lang.String f,
java.lang.String s)
public void print(java.lang.String f,
char c)
public void print(java.lang.String f,
long d)
public void print(java.lang.String f,
double d)
public void format(java.lang.String s)
public void format(long d)
public void format(double x)
public void format(char c)
public void setOutputStream(java.io.OutputStream os)
public void setEolIdentifier(int opsys)
public static FILE write(java.lang.String file)
public static void setTryFiles(boolean t)
public static boolean getTryFiles()
public static void setDebug(boolean state)
public static void setDocumentBase(java.net.URL url)
public static void setCodeBase(java.net.URL url)
public static java.lang.Exception getException()
public java.io.InputStream getInputStream()
public void setCharactersInBuffer(int i)
public int read()
read in class java.io.InputStreampublic int skip(int byteCount)
public void ungetc(int c)
public int getLineLength()
public boolean nextLine()
public java.lang.String readLine()
public java.lang.String getCurrentLineAsString()
public char getChar(int offset)
public boolean currentLineContains(java.lang.String string,
int offset)
public java.lang.String getSubstring(int offset,
int length)
public int readInteger(int offset,
int length)
public int readInteger3(int offset)
public double readDouble(int offset,
int length)
public int getFieldCount()
public int getFieldStart(int f)
public int getFieldLength(int f)
public java.lang.String getField(int f)
public byte getFieldChar(int f,
int c)
public static java.lang.String getRelativePath(java.lang.String path)
public static FILE open(java.lang.String resource)
public static boolean stringIsURL(java.lang.String resource)
public static FILE open(java.io.File file)
public static FILE openFile(java.lang.String filename)
public static FILE openURL(java.lang.String urlname)
public static FILE open(java.net.URL url)
public void close()
close in interface java.io.Closeableclose in class java.io.InputStreampublic static java.util.Properties loadProperties(java.lang.String resource)
public int getInteger(int f)
public float getFloat(int f)
public double getDouble(int f)
public int readIntegerFromField(int f)
public double readDoubleFromField(int f)
public static int readInteger(java.lang.String string)
public static double readDouble(java.lang.String string)
public static java.lang.String[] split(java.lang.String string)
public static java.lang.String[] split(java.lang.String string,
java.lang.String separators)
public static void main(java.lang.String[] args)
public static int readFrom(FILE file)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||