org.das2.qstream.TransferType

A transfer type is an encoding of a double on to the stream. It must have a fixed length in bytes. Some are pure ASCII, and isAscii can be used to check this.

TransferType( )


allocate

allocate( int recordLengthBytes, java.nio.ByteOrder byteOrder ) → java.nio.ByteBuffer

convenient method which gently reminds that the ByteOrder needs to be specified with ByteBuffers. ByteBuffers are created with big endian turned on, but more often little endian is used.

Parameters

recordLengthBytes - an int
byteOrder - a ByteOrder

Returns:

the byte buffer with the order set.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getForName

getForName( String ttype, java.util.Map properties ) → org.das2.qstream.TransferType

returns a TranferType for the given name, or null if none is found.

Parameters

ttype - a String
properties - map of dataset properties. Introduced to pass in time Unit to AsciiTimeTransferType without unduly coupling codes.

Returns:

returns a TranferType for the given name, or null if none is found.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


isAscii

isAscii( ) → boolean

return true if the transfer type uses ASCII-encodings to represent data. It's assumed in this case that trailing whitespace can be modified for readability.

Returns:

true if the type is ASCII-based.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


name

name( ) → String

return a string identifying the TransferType.

Returns:

the name

[search for examples] [view on GitHub] [view on old javadoc] [view source]


read

read( java.nio.ByteBuffer buffer ) → double

read the data from the buffer. The implementations will increment the buffer's position by sizeBytes.

Parameters

buffer - the container for the transfer type.

Returns:

the value read

[search for examples] [view on GitHub] [view on old javadoc] [view source]


sizeBytes

sizeBytes( ) → int

return the number of bytes used by the transfer type.

Returns:

the size of the type in bytes.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


toString

toString( ) → String

Returns:

java.lang.String

[search for examples] [view on GitHub] [view on old javadoc] [view source]


write

write( double d, java.nio.ByteBuffer buffer ) → void

write the data to the buffer. The buffer's position should be incremented by sizeBytes.

Parameters

d - the value to write.
buffer - the byte buffer positioned to receive sizeByte bytes.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]