Package com.automation_pros.odva.endian
Class EndianNioOutput
- java.lang.Object
-
- com.automation_pros.odva.endian.EndianNioOutput
-
- All Implemented Interfaces:
EndianDataOutput,java.io.DataOutput
public class EndianNioOutput extends java.lang.Object implements EndianDataOutput
Wrap a NIO ByteBuffer for use as either EndianDataInput or EndianDataOutput compatible with any Capsule subclass. Includes inverse skip handling for fixed-length typed reads and writes.
-
-
Constructor Summary
Constructors Constructor Description EndianNioOutput(java.nio.ByteBuffer buf)Wrap the given bytebuffer for use in the Capsule class and any of its subclasses.EndianNioOutput(java.nio.ByteBuffer buf, int skip)Wrap the given bytebuffer for use in the Capsule class and any of its subclasses, initializing the preliminary bytes to skip.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckWriteSkip(int n)java.nio.ByteBuffergetBuffer()protected voidput(byte b)intremaining()voidwrite(byte[] bytes)voidwrite(byte[] bytes, int offset, int length)voidwrite(int b)voidwriteBoolean(boolean b)voidwriteByte(int b)voidwriteBytes(java.lang.String s)voidwriteChar(int v)voidwriteCharLE(int v)Little-endian counterpart towriteChar().voidwriteChars(java.lang.String s)voidwriteCharsLE(java.lang.String s)Little-endian counterpart towriteChars().voidwriteDouble(double v)voidwriteDoubleLE(double v)Little-endian counterpart towriteDouble().voidwriteFloat(float v)voidwriteFloatLE(float f)Little-endian counterpart towriteFloat().voidwriteInt(int v)voidwriteIntLE(int v)Little-endian counterpart towriteInt().voidwriteLong(long v)voidwriteLongLE(long v)Little-endian counterpart towriteLong().voidwriteShort(int v)voidwriteShortLE(int v)Little-endian counterpart towriteShort().voidwriteUTF(java.lang.String s)
-
-
-
Constructor Detail
-
EndianNioOutput
public EndianNioOutput(java.nio.ByteBuffer buf)
Wrap the given bytebuffer for use in the Capsule class and any of its subclasses.
-
EndianNioOutput
public EndianNioOutput(java.nio.ByteBuffer buf, int skip)Wrap the given bytebuffer for use in the Capsule class and any of its subclasses, initializing the preliminary bytes to skip.
-
-
Method Detail
-
put
protected void put(byte b) throws java.io.IOException- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Throws:
java.io.IOException
-
write
public void write(byte[] bytes) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Throws:
java.io.IOException
-
write
public void write(byte[] bytes, int offset, int length) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeBoolean
public void writeBoolean(boolean b) throws java.io.IOException- Specified by:
writeBooleanin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeByte
public void writeByte(int b) throws java.io.IOException- Specified by:
writeBytein interfacejava.io.DataOutput- Throws:
java.io.IOException
-
checkWriteSkip
protected boolean checkWriteSkip(int n) throws java.io.IOException- Throws:
java.io.IOException
-
writeShort
public void writeShort(int v) throws java.io.IOException- Specified by:
writeShortin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeChar
public void writeChar(int v) throws java.io.IOException- Specified by:
writeCharin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeInt
public void writeInt(int v) throws java.io.IOException- Specified by:
writeIntin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeLong
public void writeLong(long v) throws java.io.IOException- Specified by:
writeLongin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeFloat
public void writeFloat(float v) throws java.io.IOException- Specified by:
writeFloatin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeDouble
public void writeDouble(double v) throws java.io.IOException- Specified by:
writeDoublein interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeBytes
public void writeBytes(java.lang.String s) throws java.io.IOException- Specified by:
writeBytesin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeChars
public void writeChars(java.lang.String s) throws java.io.IOException- Specified by:
writeCharsin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeUTF
public void writeUTF(java.lang.String s) throws java.io.IOException- Specified by:
writeUTFin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeCharLE
public void writeCharLE(int v) throws java.io.IOExceptionDescription copied from interface:EndianDataOutputLittle-endian counterpart towriteChar().- Specified by:
writeCharLEin interfaceEndianDataOutput- Throws:
java.io.IOException
-
writeCharsLE
public void writeCharsLE(java.lang.String s) throws java.io.IOExceptionDescription copied from interface:EndianDataOutputLittle-endian counterpart towriteChars().- Specified by:
writeCharsLEin interfaceEndianDataOutput- Throws:
java.io.IOException
-
writeDoubleLE
public void writeDoubleLE(double v) throws java.io.IOExceptionDescription copied from interface:EndianDataOutputLittle-endian counterpart towriteDouble().- Specified by:
writeDoubleLEin interfaceEndianDataOutput- Throws:
java.io.IOException
-
writeFloatLE
public void writeFloatLE(float f) throws java.io.IOExceptionDescription copied from interface:EndianDataOutputLittle-endian counterpart towriteFloat().- Specified by:
writeFloatLEin interfaceEndianDataOutput- Throws:
java.io.IOException
-
writeShortLE
public void writeShortLE(int v) throws java.io.IOExceptionDescription copied from interface:EndianDataOutputLittle-endian counterpart towriteShort().- Specified by:
writeShortLEin interfaceEndianDataOutput- Throws:
java.io.IOException
-
writeIntLE
public void writeIntLE(int v) throws java.io.IOExceptionDescription copied from interface:EndianDataOutputLittle-endian counterpart towriteInt().- Specified by:
writeIntLEin interfaceEndianDataOutput- Throws:
java.io.IOException
-
writeLongLE
public void writeLongLE(long v) throws java.io.IOExceptionDescription copied from interface:EndianDataOutputLittle-endian counterpart towriteLong().- Specified by:
writeLongLEin interfaceEndianDataOutput- Throws:
java.io.IOException
-
getBuffer
public java.nio.ByteBuffer getBuffer()
-
remaining
public int remaining() throws java.io.IOException- Throws:
java.io.IOException
-
-