iText 8.0.2 API
iText.Kernel.XMP.Impl.ByteBuffer Class Reference

Byte buffer container including length of valid data. More...

Public Member Functions

  ByteBuffer (int initialCapacity)
 
Parameters
initialCapacity the initial capacity for this buffer

 
  ByteBuffer (byte[] buffer)
 
Parameters
buffer a byte array that will be wrapped with ByteBuffer.

 
  ByteBuffer (byte[] buffer, int length)
 
  ByteBuffer (Stream @in)
  Loads the stream into a buffer. More...
 
  ByteBuffer (byte[] buffer, int offset, int length)
 
virtual Stream  GetByteStream ()
 
Returns
Returns a byte stream that is limited to the valid amount of bytes.

 
virtual int  Length ()
 
virtual byte  ByteAt (int index)
 
virtual int  CharAt (int index)
 
virtual void  Append (byte b)
  Appends a byte to the buffer. More...
 
virtual void  Append (byte[] bytes, int offset, int len)
  Appends a part of byte array to the buffer. More...
 
virtual void  Append (byte[] bytes)
  Append a byte array to the buffer More...
 
virtual void  Append (iText.Kernel.XMP.Impl.ByteBuffer anotherBuffer)
  Append another buffer to this buffer. More...
 
virtual String  GetEncoding ()
  Detects the encoding of the byte buffer, stores and returns it. More...
 

Detailed Description

Byte buffer container including length of valid data.

11.10.2006

Constructor & Destructor Documentation

◆ ByteBuffer() [1/3]

iText.Kernel.XMP.Impl.ByteBuffer.ByteBuffer ( byte[]  buffer,
int  length 
)
inline
Parameters
buffer a byte array that will be wrapped with ByteBuffer.
length the length of valid bytes in the array

◆ ByteBuffer() [2/3]

iText.Kernel.XMP.Impl.ByteBuffer.ByteBuffer ( Stream @  in )
inline

Loads the stream into a buffer.

Parameters
in an InputStream

◆ ByteBuffer() [3/3]

iText.Kernel.XMP.Impl.ByteBuffer.ByteBuffer ( byte[]  buffer,
int  offset,
int  length 
)
inline
Parameters
buffer a byte array that will be wrapped with ByteBuffer.
offset the offset of the provided buffer.
length the length of valid bytes in the array

Member Function Documentation

◆ Append() [1/4]

virtual void iText.Kernel.XMP.Impl.ByteBuffer.Append ( byte  b )
inlinevirtual

Appends a byte to the buffer.

Parameters
b a byte

◆ Append() [2/4]

virtual void iText.Kernel.XMP.Impl.ByteBuffer.Append ( byte[]  bytes )
inlinevirtual

Append a byte array to the buffer

Parameters
bytes a byte array

◆ Append() [3/4]

virtual void iText.Kernel.XMP.Impl.ByteBuffer.Append ( byte[]  bytes,
int  offset,
int  len 
)
inlinevirtual

Appends a part of byte array to the buffer.

Appends a part of byte array to the buffer. Elements on positions offset through offset+len-1 of provided array will be copied

Parameters
bytes a byte array
offset is a position of the first element to copy
len the number of array elements to be added

◆ Append() [4/4]

virtual void iText.Kernel.XMP.Impl.ByteBuffer.Append ( iText.Kernel.XMP.Impl.ByteBuffer  anotherBuffer )
inlinevirtual

Append another buffer to this buffer.

Parameters
anotherBuffer another ByteBuffer

◆ ByteAt()

virtual byte iText.Kernel.XMP.Impl.ByteBuffer.ByteAt ( int  index )
inlinevirtual
           Note: Only the byte up to length are valid!
           @return Returns the inner byte buffer.
          ‍/

public byte[] getBuffer() { return buffer; } /**

Parameters
index the index to retrieve the byte from
Returns
Returns a byte from the buffer

◆ CharAt()

virtual int iText.Kernel.XMP.Impl.ByteBuffer.CharAt ( int  index )
inlinevirtual
Parameters
index the index to retrieve a byte as int or char.
Returns
Returns a byte from the buffer

◆ GetEncoding()

virtual String iText.Kernel.XMP.Impl.ByteBuffer.GetEncoding ( )
inlinevirtual

Detects the encoding of the byte buffer, stores and returns it.

Detects the encoding of the byte buffer, stores and returns it. Only UTF-8, UTF-16LE/BE and UTF-32LE/BE are recognized. Note: UTF-32 flavors are not supported by Java, the XML-parser will complain.

Returns
Returns the encoding string.

◆ Length()

virtual int iText.Kernel.XMP.Impl.ByteBuffer.Length ( )
inlinevirtual
Returns
Returns the length, that means the number of valid bytes, of the buffer; the inner byte array might be bigger than that.