org.openmuc.jasn1.ber
Class BerByteArrayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.openmuc.jasn1.ber.BerByteArrayOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class BerByteArrayOutputStream
extends java.io.OutputStream


Field Summary
 byte[] buffer
           
 int index
           
 
Constructor Summary
BerByteArrayOutputStream(byte[] buffer, int startingIndex)
           
BerByteArrayOutputStream(byte[] buffer, int startingIndex, boolean automaticResize)
           
BerByteArrayOutputStream(int bufferSize)
          Creates a BerByteArrayOutputStream with a byte array of size bufferSize.
BerByteArrayOutputStream(int bufferSize, boolean automaticResize)
           
 
Method Summary
 byte[] getArray()
          Returns a new array containing the subarray of the stream array that contains the coded content.
 java.nio.ByteBuffer getByteBuffer()
           
 void write(byte arg0)
           
 void write(byte[] byteArray)
           
 void write(int arg0)
           
 
Methods inherited from class java.io.OutputStream
close, flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

public byte[] buffer

index

public int index
Constructor Detail

BerByteArrayOutputStream

public BerByteArrayOutputStream(int bufferSize)
Creates a BerByteArrayOutputStream with a byte array of size bufferSize. The buffer will not be resized automatically. Use BerByteArrayOutputStream(int, boolean) instead if you want the buffer to be dynamically resized.

Parameters:
bufferSize - the size of the underlying buffer

BerByteArrayOutputStream

public BerByteArrayOutputStream(int bufferSize,
                                boolean automaticResize)

BerByteArrayOutputStream

public BerByteArrayOutputStream(byte[] buffer,
                                int startingIndex)

BerByteArrayOutputStream

public BerByteArrayOutputStream(byte[] buffer,
                                int startingIndex,
                                boolean automaticResize)
Method Detail

write

public void write(int arg0)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte arg0)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] byteArray)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

getArray

public byte[] getArray()
Returns a new array containing the subarray of the stream array that contains the coded content.


getByteBuffer

public java.nio.ByteBuffer getByteBuffer()