All Packages Class Hierarchy This Package Previous Next Index
Class com.starla.lite.SMBInputStream
java.lang.Object
|
+----java.io.InputStream
|
+----com.starla.lite.SMBInputStream
- public class SMBInputStream
- extends InputStream
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 ();
- Version:
- 1.0
-
available()
- Return the number of bytes that can be read from this input stream
without blocking.
-
close()
- Close the input stream and release any system resources associated with
the stream.
-
File()
- Return a reference to the associated SMBFile object.
-
read()
- Read a byte of data from the input stream.
-
read(byte[], int, int)
- Read a block of bytes from the input stream.
-
skip(int)
- Skip over a number of bytes in the input stream.
available
public int available() throws IOException
- Return the number of bytes that can be read from this input stream
without blocking.
- Returns:
- Number of bytes that can be read without the input stream blocking.
- Throws: IOException
- If an I/O error occurs.
- Overrides:
- available in class InputStream
close
public void close() throws IOException
- Close the input stream and release any system resources associated with
the stream.
- Throws: IOException
- If an I/O error occurs.
- Overrides:
- close in class InputStream
File
public final SMBFile File()
- Return a reference to the associated SMBFile object.
- Returns:
- SMBFile associated with this input stream.
read
public int read() throws IOException
- Read a byte of data from the input stream.
- Returns:
- The next byte of data, or -1 if the end of file has been reached.
- Throws: IOException
- If an I/O error occurs.
- Overrides:
- read in class InputStream
read
public int read(byte buf[],
int off,
int len) throws IOException
- Read a block of bytes from the input stream.
- Parameters:
- 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.
- Returns:
- The number of bytes read into the buffer, or -1 if the end of
file has been reached.
- Throws: IOException
- If an I/O error occurs.
- Overrides:
- read in class InputStream
skip
public int skip(int n) throws IOException
- Skip over a number of bytes in the input stream.
- Parameters:
- n - Number of bytes to skip.
- Returns:
- The actual number of bytes skipped.
- Throws: IOException
- If an I/O error occurs.
All Packages Class Hierarchy This Package Previous Next Index