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 voidclose()Close the byte writerByteOrdergetByteOrder()Get the byte orderbyte[]getBytes()Get the written bytesByteArrayOutputStreamgetOutputStream()Get the byte array output streamvoidsetByteOrder(ByteOrder byteOrder)Set the byte orderintsize()Get the current size in bytes writtenvoidwriteByte(byte value)Write a bytevoidwriteBytes(byte[] value)Write the bytesvoidwriteDouble(double value)Write a doublevoidwriteFloat(float value)Write a floatvoidwriteInt(int value)Write an integervoidwriteShort(short value)Write a shortintwriteString(String value)Write a StringvoidwriteUnsignedByte(short value)Write an unsigned bytevoidwriteUnsignedInt(long value)Write an unsigned intvoidwriteUnsignedShort(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 IOExceptionWrite the bytes- Parameters:
value- bytes- Throws:
IOException- upon failure to write
-
writeShort
public void writeShort(short value) throws IOExceptionWrite a short- Parameters:
value- short- Throws:
IOException- upon failure to write
-
writeUnsignedShort
public void writeUnsignedShort(int value) throws IOExceptionWrite an unsigned short- Parameters:
value- unsigned short as an int- Throws:
IOException- upon failure to write
-
writeInt
public void writeInt(int value) throws IOExceptionWrite an integer- Parameters:
value- int- Throws:
IOException- upon failure to write
-
writeUnsignedInt
public void writeUnsignedInt(long value) throws IOExceptionWrite an unsigned int- Parameters:
value- unsigned int as long- Throws:
IOException- upon failure to write
-
writeFloat
public void writeFloat(float value) throws IOExceptionWrite a float- Parameters:
value- float- Throws:
IOException- upon failure to write
-
writeDouble
public void writeDouble(double value) throws IOExceptionWrite a double- Parameters:
value- double- Throws:
IOException- upon failure to write
-
-