Package jcifs.smb
Class SmbFileInputStream
java.lang.Object
java.io.InputStream
jcifs.smb.SmbFileInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
This InputStream can read bytes from a file on an SMB file server. Offsets are 64 bits.
-
Constructor Summary
ConstructorsConstructorDescriptionSmbFileInputStream
(String url) Creates anInputStream
for reading bytes from a file on an SMB server addressed by theurl
parameter.SmbFileInputStream
(SmbFile file) Creates anInputStream
for reading bytes from a file on an SMB server represented by theSmbFile
parameter. -
Method Summary
Modifier and TypeMethodDescriptionint
This stream class is unbuffered.void
close()
Closes this input stream and releases any system resources associated with the stream.int
read()
Reads a byte of data from this input stream.int
read
(byte[] b) Reads up to b.length bytes of data from this input stream into an array of bytes.int
read
(byte[] b, int off, int len) Reads up to len bytes of data from this input stream into an array of bytes.int
readDirect
(byte[] b, int off, int len) protected IOException
seToIoe
(SmbException se) long
skip
(long n) Skip n bytes of data on this stream.Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Constructor Details
-
SmbFileInputStream
public SmbFileInputStream(String url) throws SmbException, MalformedURLException, UnknownHostException Creates anInputStream
for reading bytes from a file on an SMB server addressed by theurl
parameter. SeeSmbFile
for a detailed description and examples of the smb URL syntax.- Parameters:
url
- An smb URL string representing the file to read from- Throws:
SmbException
MalformedURLException
UnknownHostException
-
SmbFileInputStream
public SmbFileInputStream(SmbFile file) throws SmbException, MalformedURLException, UnknownHostException Creates anInputStream
for reading bytes from a file on an SMB server represented by theSmbFile
parameter. SeeSmbFile
for a detailed description and examples of the smb URL syntax.- Parameters:
file
- AnSmbFile
specifying the file to read from- Throws:
SmbException
MalformedURLException
UnknownHostException
-
-
Method Details
-
seToIoe
-
close
Closes this input stream and releases any system resources associated with the stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- if a network error occurs
-
read
Reads a byte of data from this input stream.- Specified by:
read
in classInputStream
- Throws:
IOException
- if a network error occurs
-
read
Reads up to b.length bytes of data from this input stream into an array of bytes.- Overrides:
read
in classInputStream
- Throws:
IOException
- if a network error occurs
-
read
Reads up to len bytes of data from this input stream into an array of bytes.- Overrides:
read
in classInputStream
- Throws:
IOException
- if a network error occurs
-
readDirect
- Throws:
IOException
-
available
This 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:
available
in classInputStream
- Throws:
IOException
-
skip
Skip 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:
skip
in classInputStream
- Throws:
IOException
-