kiwi-postgis  Version 0.1.0.0
TWKBReader.ByteBufferInputStream Class Reference
Inheritance diagram for TWKBReader.ByteBufferInputStream:
Collaboration diagram for TWKBReader.ByteBufferInputStream:

Public Member Functions

 ByteBufferInputStream (final ByteBuffer byteBuffer)
 
int read () throws IOException
 
int read (final byte[] bytes, final int offset, final int length) throws IOException
 
int available () throws IOException
 

Private Attributes

final ByteBuffer byteBuffer
 

Constructor & Destructor Documentation

◆ ByteBufferInputStream()

ByteBufferInputStream ( final ByteBuffer  byteBuffer)

References TWKBReader.ByteBufferInputStream.byteBuffer.

Referenced by TWKBReader.read().

38  {
39  this.byteBuffer = byteBuffer;
40  }

Member Function Documentation

◆ available()

int available ( ) throws IOException
64  {
65  return byteBuffer.remaining();
66  }

◆ read() [1/2]

int read ( ) throws IOException

Referenced by TWKBReader.read(), and TWKBReader.readGeometryCollection().

43  {
44  if (!byteBuffer.hasRemaining()) {
45  return -1;
46  }
47  return byteBuffer.get() & 0xFF;
48  }

◆ read() [2/2]

int read ( final byte []  bytes,
final int  offset,
final int  length 
) throws IOException
51  {
52  if (length == 0) {
53  return 0;
54  }
55  final int count = Math.min(byteBuffer.remaining(), length);
56  if (count == 0) {
57  return -1;
58  }
59  byteBuffer.get(bytes, offset, count);
60  return count;
61  }

Member Data Documentation

◆ byteBuffer

final ByteBuffer byteBuffer
private