Class 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.OutputStream getOutputStream()  
      java.io.OutputStream getOutputStream​(ProgressListener listener, long offset)  
      int write​(byte[] buffer, long fileOffset)
      Write the data in buffer to this file at position fileOffset.
      int write​(byte[] buffer, long fileOffset, int offset, int length)
      Write the data in buffer to this file at position fileOffset.
      int write​(ByteChunkProvider provider)
      Write all available data from the byte chunk provider to this file.
      int write​(ByteChunkProvider provider, ProgressListener progressListener)
      Write all available data from the byte chunk provider to this file.
      java.util.concurrent.Future<java.lang.Integer> 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.Integer> writeAsync​(ByteChunkProvider provider)
      Async Write all available data from the byte chunk provider to this file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SMB2Writer

        public SMB2Writer​(Share share,
                          SMB2FileId fileId,
                          java.lang.String entryName)
    • Method Detail

      • write

        public int 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 int 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 int 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 int 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 java.util.concurrent.Future<java.lang.Integer> 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 java.util.concurrent.Future<java.lang.Integer> 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 java.io.OutputStream getOutputStream()
      • getOutputStream

        public java.io.OutputStream getOutputStream​(ProgressListener listener,
                                                    long offset)