Class ChannelDataOutput.ArrayWriter
java.lang.Object
org.apache.sis.internal.storage.io.ChannelDataOutput.ArrayWriter
- Enclosing class:
- ChannelDataOutput
Helper class for the
writeFully(…) methods,
in order to avoid duplicating almost identical code many times.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract BufferCreates a new buffer of the type required by the array to write.private voidskipInBuffer(int nByte) Skips the given amount of bytes in the buffer.(package private) abstract voidtransfer(int offset, int length) Transfers the data from the array of primitive Java type known by the subclass into buffer created bycreateView().(package private) final voidwriteFully(int dataSize, int offset, int length) Writeslengthcharacters from the array to the stream.
-
Constructor Details
-
ArrayWriter
private ArrayWriter()
-
-
Method Details
-
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 bycreateView(). 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
Writeslengthcharacters 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 withinsrcto write.length- the number of characters to write.- Throws:
IOException- if an error occurred while writing the stream.
-