Package mil.nga.tiff.io
Class ByteWriter
- java.lang.Object
-
- mil.nga.tiff.io.ByteWriter
-
public class ByteWriter extends Object
Write a byte array- Author:
- osbornb
-
-
Constructor Summary
Constructors Constructor Description ByteWriter()
ConstructorByteWriter(ByteOrder byteOrder)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the byte writerByteOrder
getByteOrder()
Get the byte orderbyte[]
getBytes()
Get the written bytesByteArrayOutputStream
getOutputStream()
Get the byte array output streamvoid
setByteOrder(ByteOrder byteOrder)
Set the byte orderint
size()
Get the current size in bytes writtenvoid
writeByte(byte value)
Write a bytevoid
writeBytes(byte[] value)
Write the bytesvoid
writeDouble(double value)
Write a doublevoid
writeFloat(float value)
Write a floatvoid
writeInt(int value)
Write an integervoid
writeShort(short value)
Write a shortint
writeString(String value)
Write a Stringvoid
writeUnsignedByte(short value)
Write an unsigned bytevoid
writeUnsignedInt(long value)
Write an unsigned intvoid
writeUnsignedShort(int value)
Write an unsigned short
-
-
-
Constructor Detail
-
ByteWriter
public ByteWriter()
Constructor
-
ByteWriter
public ByteWriter(ByteOrder byteOrder)
Constructor- Parameters:
byteOrder
- byte order
-
-
Method Detail
-
close
public void close()
Close the byte writer
-
getOutputStream
public ByteArrayOutputStream getOutputStream()
Get the byte array output stream- Returns:
- byte array output stream
-
getByteOrder
public ByteOrder getByteOrder()
Get the byte order- Returns:
- byte order
-
setByteOrder
public void setByteOrder(ByteOrder byteOrder)
Set the byte order- Parameters:
byteOrder
- byte order
-
getBytes
public byte[] getBytes()
Get the written bytes- Returns:
- written bytes
-
size
public int size()
Get the current size in bytes written- Returns:
- bytes written
-
writeString
public int writeString(String value) throws IOException
Write a String- Parameters:
value
- string value- Returns:
- bytes written
- Throws:
IOException
- upon failure to write
-
writeByte
public void writeByte(byte value)
Write a byte- Parameters:
value
- byte
-
writeUnsignedByte
public void writeUnsignedByte(short value)
Write an unsigned byte- Parameters:
value
- unsigned byte as a short
-
writeBytes
public void writeBytes(byte[] value) throws IOException
Write the bytes- Parameters:
value
- bytes- Throws:
IOException
- upon failure to write
-
writeShort
public void writeShort(short value) throws IOException
Write a short- Parameters:
value
- short- Throws:
IOException
- upon failure to write
-
writeUnsignedShort
public void writeUnsignedShort(int value) throws IOException
Write an unsigned short- Parameters:
value
- unsigned short as an int- Throws:
IOException
- upon failure to write
-
writeInt
public void writeInt(int value) throws IOException
Write an integer- Parameters:
value
- int- Throws:
IOException
- upon failure to write
-
writeUnsignedInt
public void writeUnsignedInt(long value) throws IOException
Write an unsigned int- Parameters:
value
- unsigned int as long- Throws:
IOException
- upon failure to write
-
writeFloat
public void writeFloat(float value) throws IOException
Write a float- Parameters:
value
- float- Throws:
IOException
- upon failure to write
-
writeDouble
public void writeDouble(double value) throws IOException
Write a double- Parameters:
value
- double- Throws:
IOException
- upon failure to write
-
-