Class SMB2Writer

java.lang.Object
com.hierynomus.smbj.share.SMB2Writer

public class SMB2Writer extends Object
Generic class that allows to write data to a share entry (Be it a printer or a file)
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • share

      private Share share
    • fileId

      private SMB2FileId fileId
    • entryName

      private String entryName
  • Constructor Details

  • Method Details

    • write

      public long write(byte[] buffer, long fileOffset)
      Write the data in buffer to this file at position fileOffset.
      Parameters:
      buffer - the data to write
      fileOffset - 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 write
      fileOffset - The offset, in bytes, into the file to which the data should be written
      offset - the start offset in the data
      length - 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 by ByteChunkProvider.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 by ByteChunkProvider.getOffset().
      Parameters:
      provider - the byte chunk provider
      progressListener - 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 Future<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 write
      fileOffset - The offset, in bytes, into the file to which the data should be written
      offset - the start offset in the data
      length - the number of bytes that are written
      Returns:
      A Future containing the total number of bytes written
    • writeAsync

      public Future<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 by ByteChunkProvider.getOffset().
      Parameters:
      provider - the byte chunk provider
      Returns:
      the List of write response future
    • getOutputStream

      public OutputStream getOutputStream()
    • getOutputStream

      public OutputStream getOutputStream(ProgressListener listener, long offset)