Package com.hierynomus.smbj.share
Class SMB2Writer
- java.lang.Object
-
- com.hierynomus.smbj.share.SMB2Writer
-
public class SMB2Writer extends java.lang.Object
Generic class that allows to write data to a share entry (Be it a printer or a file)
-
-
Constructor Summary
Constructors Constructor Description SMB2Writer(Share share, SMB2FileId fileId, java.lang.String entryName)
-
Method Summary
Modifier and Type Method Description java.io.OutputStream
getOutputStream()
java.io.OutputStream
getOutputStream(ProgressListener listener, long offset)
long
write(byte[] buffer, long fileOffset)
Write the data in buffer to this file at position fileOffset.long
write(byte[] buffer, long fileOffset, int offset, int length)
Write the data in buffer to this file at position fileOffset.long
write(ByteChunkProvider provider)
Write all available data from the byte chunk provider to this file.long
write(ByteChunkProvider provider, ProgressListener progressListener)
Write all available data from the byte chunk provider to this file.java.util.concurrent.Future<java.lang.Long>
writeAsync(byte[] buffer, long fileOffset, int offset, int length)
Write the data Async in buffer to this file at position fileOffset.java.util.concurrent.Future<java.lang.Long>
writeAsync(ByteChunkProvider provider)
Async Write all available data from the byte chunk provider to this file.
-
-
-
Constructor Detail
-
SMB2Writer
public SMB2Writer(Share share, SMB2FileId fileId, java.lang.String entryName)
-
-
Method Detail
-
write
public long write(byte[] buffer, long fileOffset)
Write the data in buffer to this file at position fileOffset.- Parameters:
buffer
- the data to writefileOffset
- The offset, in bytes, into the file to which the data should be written- Returns:
- the actual number of bytes that was written to the file
-
write
public long write(byte[] buffer, long fileOffset, int offset, int length)
Write the data in buffer to this file at position fileOffset.- Parameters:
buffer
- the data to writefileOffset
- The offset, in bytes, into the file to which the data should be writtenoffset
- the start offset in the datalength
- the number of bytes that are written- Returns:
- the actual number of bytes that was written to the file
-
write
public long write(ByteChunkProvider provider)
Write all available data from the byte chunk provider to this file. The offset in the file to which data is written is determined byByteChunkProvider.getOffset()
.- Parameters:
provider
- the byte chunk provider- Returns:
- the actual number of bytes that was written to the file
-
write
public long write(ByteChunkProvider provider, ProgressListener progressListener)
Write all available data from the byte chunk provider to this file. The offset in the file to which data is written is determined byByteChunkProvider.getOffset()
.- Parameters:
provider
- the byte chunk providerprogressListener
- an optional callback that will be invoked when data has been written to the file- Returns:
- the actual number of bytes that was written to the file
-
writeAsync
public java.util.concurrent.Future<java.lang.Long> writeAsync(byte[] buffer, long fileOffset, int offset, int length)
Write the data Async in buffer to this file at position fileOffset.- Parameters:
buffer
- the data to writefileOffset
- The offset, in bytes, into the file to which the data should be writtenoffset
- the start offset in the datalength
- the number of bytes that are written- Returns:
- A Future containing the total number of bytes written
-
writeAsync
public java.util.concurrent.Future<java.lang.Long> writeAsync(ByteChunkProvider provider)
Async Write all available data from the byte chunk provider to this file. The offset in the file to which data is written is determined byByteChunkProvider.getOffset()
.- Parameters:
provider
- the byte chunk provider- Returns:
- the List of write response future
-
getOutputStream
public java.io.OutputStream getOutputStream()
-
getOutputStream
public java.io.OutputStream getOutputStream(ProgressListener listener, long offset)
-
-