Package jcifs.smb
Class SmbFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- jcifs.smb.SmbFileInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class SmbFileInputStream extends java.io.InputStreamThis InputStream can read bytes from a file on an SMB file server. Offsets are 64 bits.
-
-
Constructor Summary
Constructors Constructor Description SmbFileInputStream(java.lang.String url)Creates anInputStreamfor reading bytes from a file on an SMB server addressed by theurlparameter.SmbFileInputStream(SmbFile file)Creates anInputStreamfor reading bytes from a file on an SMB server represented by theSmbFileparameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()This stream class is unbuffered.voidclose()Closes this input stream and releases any system resources associated with the stream.intread()Reads a byte of data from this input stream.intread(byte[] b)Reads up to b.length bytes of data from this input stream into an array of bytes.intread(byte[] b, int off, int len)Reads up to len bytes of data from this input stream into an array of bytes.intreadDirect(byte[] b, int off, int len)protected java.io.IOExceptionseToIoe(SmbException se)longskip(long n)Skip n bytes of data on this stream.
-
-
-
Constructor Detail
-
SmbFileInputStream
public SmbFileInputStream(java.lang.String url) throws SmbException, java.net.MalformedURLException, java.net.UnknownHostExceptionCreates anInputStreamfor reading bytes from a file on an SMB server addressed by theurlparameter. SeeSmbFilefor a detailed description and examples of the smb URL syntax.- Parameters:
url- An smb URL string representing the file to read from- Throws:
SmbExceptionjava.net.MalformedURLExceptionjava.net.UnknownHostException
-
SmbFileInputStream
public SmbFileInputStream(SmbFile file) throws SmbException, java.net.MalformedURLException, java.net.UnknownHostException
Creates anInputStreamfor reading bytes from a file on an SMB server represented by theSmbFileparameter. SeeSmbFilefor a detailed description and examples of the smb URL syntax.- Parameters:
file- AnSmbFilespecifying the file to read from- Throws:
SmbExceptionjava.net.MalformedURLExceptionjava.net.UnknownHostException
-
-
Method Detail
-
seToIoe
protected java.io.IOException seToIoe(SmbException se)
-
close
public void close() throws java.io.IOExceptionCloses this input stream and releases any system resources associated with the stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException- if a network error occurs
-
read
public int read() throws java.io.IOExceptionReads a byte of data from this input stream.- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException- if a network error occurs
-
read
public int read(byte[] b) throws java.io.IOExceptionReads up to b.length bytes of data from this input stream into an array of bytes.- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException- if a network error occurs
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionReads up to len bytes of data from this input stream into an array of bytes.- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException- if a network error occurs
-
readDirect
public int readDirect(byte[] b, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOExceptionThis stream class is unbuffered. Therefore this method will always return 0 for streams connected to regular files. However, a stream created from a Named Pipe this method will query the server using a "peek named pipe" operation and return the number of available bytes on the server.- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOExceptionSkip n bytes of data on this stream. This operation will not result in any IO with the server. Unlink InputStream value less than the one provided will not be returned if it exceeds the end of the file (if this is a problem let us know).- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
-