|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--com.starla.smb.SMBInputStream
SMB input stream class.
The SMBInputStream class provides a standard InputStream interface to a remote file.
The class may be used with other I/O stream classes such as InputStreamReader, DataInputStream etc.
Note: It is not necessary to use a BufferedInputStream or BufferedReader class with the SMBInputStream as the underlying network connection will usually buffer 4Kb of data, up to a maximum of 64Kb.
Example use of the SMBInputStream class
PCShare shr = new PCShare ( "\\\\TEST\\C\\");
SMBDiskSession sess = SMBSessionFactory.OpenDisk ( shr);
SMBInputStream in = sess.OpenInputStream ( "DATAFILE.IN", SMBAccessMode.ReadOnly);
LineNumberReader lnRdr = new LineNumberReader ( new InputStreamReader ( in));
String inRec = null;
while (( inRec = lnRdr.readLine ()) != null)
System.out.println ( lnRdr.getLineNumber () + ": " + inRec);
in.close ();
Method Summary | |
int |
available()
Return the number of bytes that can be read from this input stream without blocking. |
void |
close()
Close the input stream and release any system resources associated with the stream. |
SMBFile |
File()
Return a reference to the associated SMBFile object. |
int |
read()
Read a byte of data from the input stream. |
int |
read(byte[] buf,
int off,
int len)
Read a block of bytes from the input stream. |
int |
skip(int n)
Skip over a number of bytes in the input stream. |
Methods inherited from class java.io.InputStream |
mark,
markSupported,
read,
reset,
skip |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public int available() throws java.io.IOException
public void close() throws java.io.IOException
public final SMBFile File()
public int read() throws java.io.IOException
public int read(byte[] buf, int off, int len) throws java.io.IOException
buf
- The buffer to read the data into.off
- The start offset to place the received data.len
- The maximum number of bytes to read.public int skip(int n) throws java.io.IOException
n
- Number of bytes to skip.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |