public class SMBInputStream
extends java.io.InputStream
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\\");
DiskSession sess = SessionFactory.OpenDisk ( shr);
SMBInputStream in = sess.OpenInputStream ( "DATAFILE.IN", AccessMode.ReadOnly);
LineNumberReader lnRdr = new LineNumberReader ( new InputStreamReader ( in));
String inRec = null;
while (( inRec = lnRdr.readLine ()) != null)
System.out.println ( lnRdr.getLineNumber () + ": " + inRec);
in.close ();
| Modifier | Constructor and Description |
|---|---|
protected |
SMBInputStream(SMBFile sfile)
Construct an SMB input stream attached to the specified SMB file.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
mark(int readLimit)
Mark the current file position
|
boolean |
markSupported()
Determine if mark is supported
|
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.
|
void |
reset()
Reset the file pointer to the previous marked position
|
int |
skip(int n)
Skip over a number of bytes in the input stream.
|
protected SMBInputStream(SMBFile sfile)
sfile - SMBFile that this input stream is associated with.public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException - If an I/O error occurs.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOException - If an I/O error occurs.public final SMBFile File()
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException - If an I/O error occurs.public int read(byte[] buf,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreambuf - The buffer to read the data into.off - The start offset to place the received data.len - The maximum number of bytes to read.java.io.IOException - If an I/O error occurs.public int skip(int n)
throws java.io.IOException
n - Number of bytes to skip.java.io.IOException - If an I/O error occurs.public void mark(int readLimit)
mark in class java.io.InputStreamreadLimit - intpublic boolean markSupported()
markSupported in class java.io.InputStreampublic void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.