public class SmbFileOutputStream
extends java.io.OutputStream
OutputStream
can write bytes to a file on an SMB file server.Constructor and Description |
---|
SmbFileOutputStream(SmbFile file)
Creates an
OutputStream for writing bytes to a file on
an SMB server represented by the SmbFile parameter. |
SmbFileOutputStream(SmbFile file,
boolean append)
Creates an
OutputStream for writing bytes to a file
on an SMB server addressed by the SmbFile parameter. |
SmbFileOutputStream(java.lang.String url)
Creates an
OutputStream for writing to a file
on an SMB server addressed by the URL parameter. |
SmbFileOutputStream(java.lang.String url,
boolean append)
Creates an
OutputStream for writing bytes to a file on an
SMB server addressed by the URL parameter. |
SmbFileOutputStream(java.lang.String url,
int shareAccess)
Creates an
OutputStream for writing bytes to a file
on an SMB server addressed by the SmbFile parameter. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this output stream and releases any system resources associated
with it.
|
boolean |
isOpen() |
void |
write(byte[] b)
Writes b.length bytes from the specified byte array to this
file output stream.
|
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array starting at
offset off to this file output stream.
|
void |
write(int b)
Writes the specified byte to this file output stream.
|
void |
writeDirect(byte[] b,
int off,
int len,
int flags)
Just bypasses TransWaitNamedPipe - used by DCERPC bind.
|
public SmbFileOutputStream(java.lang.String url) throws SmbException, java.net.MalformedURLException, java.net.UnknownHostException
OutputStream
for writing to a file
on an SMB server addressed by the URL parameter. See SmbFile
for a detailed description and examples of
the smb URL syntax.url
- An smb URL string representing the file to write toSmbException
java.net.MalformedURLException
java.net.UnknownHostException
public SmbFileOutputStream(SmbFile file) throws SmbException, java.net.MalformedURLException, java.net.UnknownHostException
OutputStream
for writing bytes to a file on
an SMB server represented by the SmbFile
parameter. See
SmbFile
for a detailed description and examples of
the smb URL syntax.file
- An SmbFile
specifying the file to write toSmbException
java.net.MalformedURLException
java.net.UnknownHostException
public SmbFileOutputStream(java.lang.String url, boolean append) throws SmbException, java.net.MalformedURLException, java.net.UnknownHostException
OutputStream
for writing bytes to a file on an
SMB server addressed by the URL parameter. See SmbFile
for a detailed description and examples of the smb URL syntax. If the
second argument is true
, then bytes will be written to the
end of the file rather than the beginning.url
- An smb URL string representing the file to write toappend
- Append to the end of fileSmbException
java.net.MalformedURLException
java.net.UnknownHostException
public SmbFileOutputStream(SmbFile file, boolean append) throws SmbException, java.net.MalformedURLException, java.net.UnknownHostException
OutputStream
for writing bytes to a file
on an SMB server addressed by the SmbFile
parameter. See
SmbFile
for a detailed description and examples of
the smb URL syntax. If the second argument is true
, then
bytes will be written to the end of the file rather than the beginning.file
- An SmbFile
representing the file to write toappend
- Append to the end of fileSmbException
java.net.MalformedURLException
java.net.UnknownHostException
public SmbFileOutputStream(java.lang.String url, int shareAccess) throws SmbException, java.net.MalformedURLException, java.net.UnknownHostException
OutputStream
for writing bytes to a file
on an SMB server addressed by the SmbFile
parameter. See
SmbFile
for a detailed description and examples of
the smb URL syntax.
The second parameter specifies how the file should be shared. If
SmbFile.FILE_NO_SHARE
is specified the client will
have exclusive access to the file. An additional open command
from jCIFS or another application will fail with the "file is being
accessed by another process" error. The FILE_SHARE_READ
,
FILE_SHARE_WRITE
, and FILE_SHARE_DELETE
may be
combined with the bitwise OR '|' to specify that other peocesses may read,
write, and/or delete the file while the jCIFS user has the file open.
url
- An smb URL representing the file to write toshareAccess
- File sharing flag: SmbFile.FILE_NOSHARE
or any combination of SmbFile.FILE_READ
, SmbFile.FILE_WRITE
, and SmbFile.FILE_DELETE
SmbException
java.net.MalformedURLException
java.net.UnknownHostException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
- if a network error occurspublic void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
- if a network error occurspublic void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
- if a network error occurspublic boolean isOpen()
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
b
- The arrayjava.io.IOException
- if a network error occurspublic void writeDirect(byte[] b, int off, int len, int flags) throws java.io.IOException
java.io.IOException