Class ChannelDataOutput.ArrayWriter

java.lang.Object
org.apache.sis.internal.storage.io.ChannelDataOutput.ArrayWriter
Enclosing class:
ChannelDataOutput

private abstract class ChannelDataOutput.ArrayWriter extends Object
Helper class for the writeFully(…) methods, in order to avoid duplicating almost identical code many times.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) abstract Buffer
    Creates a new buffer of the type required by the array to write.
    private void
    skipInBuffer(int nByte)
    Skips the given amount of bytes in the buffer.
    (package private) abstract void
    transfer(int offset, int length)
    Transfers the data from the array of primitive Java type known by the subclass into buffer created by createView().
    (package private) final void
    writeFully(int dataSize, int offset, int length)
    Writes length characters from the array to the stream.

    Methods inherited from class java.lang.Object

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

    • ArrayWriter

      private ArrayWriter()
  • Method Details

    • createView

      abstract Buffer createView()
      Creates a new buffer of the type required by the array to write. This method is guaranteed to be invoked exactly once.
    • transfer

      abstract void transfer(int offset, int length)
      Transfers the data from the array of primitive Java type known by the subclass into buffer created by createView(). This method may be invoked an arbitrary number of times.
    • skipInBuffer

      private void skipInBuffer(int nByte)
      Skips the given amount of bytes in the buffer. It is caller responsibility to ensure that there is enough bytes remaining in the buffer.
      Parameters:
      nByte - byte shift of buffer position.
    • writeFully

      final void writeFully(int dataSize, int offset, int length) throws IOException
      Writes length characters from the array to the stream.
      Parameters:
      dataSize - the size of the Java primitive type which is the element of the array.
      offset - the starting position within src to write.
      length - the number of characters to write.
      Throws:
      IOException - if an error occurred while writing the stream.