JBoss Marshalling 1.3.0.CR9

org.jboss.marshalling
Class SimpleDataOutput

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jboss.marshalling.SimpleByteOutput
          extended by org.jboss.marshalling.ByteOutputStream
              extended by org.jboss.marshalling.SimpleDataOutput
All Implemented Interfaces:
Closeable, DataOutput, Flushable, ByteOutput
Direct Known Subclasses:
AbstractObjectOutput

public class SimpleDataOutput
extends ByteOutputStream
implements DataOutput


Field Summary
protected  byte[] buffer
           
protected  int bufferSize
           
 
Fields inherited from class org.jboss.marshalling.ByteOutputStream
byteOutput
 
Constructor Summary
SimpleDataOutput(ByteOutput byteOutput)
           
SimpleDataOutput(int bufferSize)
           
SimpleDataOutput(int bufferSize, ByteOutput byteOutput)
           
 
Method Summary
 void close()
          
protected  void finish()
          Finish writing to a stream.
 void flush()
          
protected  void shallowFlush()
          This shallow flush will write the internal buffer out to the ByteOutput, but will not flush it.
protected  void start(ByteOutput byteOutput)
          Begin writing to a stream.
 void write(byte[] bytes)
          Write all the bytes from the given array to the stream.
 void write(byte[] bytes, int off, int len)
          Write some of the bytes from the given array to the stream.
 void write(int v)
          Writes to the output stream the eight low-order bits of the argument b.
 void writeBoolean(boolean v)
          
 void writeByte(int v)
          
 void writeBytes(String s)
          
 void writeChar(int v)
          
 void writeChars(String s)
          
 void writeDouble(double v)
          
 void writeFloat(float v)
          
 void writeInt(int v)
          
 void writeLong(long v)
          
 void writeShort(int v)
          
 void writeUTF(String s)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bufferSize

protected final int bufferSize

buffer

protected byte[] buffer
Constructor Detail

SimpleDataOutput

public SimpleDataOutput(int bufferSize)

SimpleDataOutput

public SimpleDataOutput(int bufferSize,
                        ByteOutput byteOutput)

SimpleDataOutput

public SimpleDataOutput(ByteOutput byteOutput)
Method Detail

write

public void write(int v)
           throws IOException
Writes to the output stream the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Specified by:
write in interface DataOutput
Specified by:
write in interface ByteOutput
Overrides:
write in class ByteOutputStream
Parameters:
v - the byte to write
Throws:
IOException - if an error occurs

write

public void write(byte[] bytes)
           throws IOException
Write all the bytes from the given array to the stream.

Specified by:
write in interface DataOutput
Specified by:
write in interface ByteOutput
Overrides:
write in class ByteOutputStream
Parameters:
bytes - the byte array
Throws:
IOException - if an error occurs

write

public void write(byte[] bytes,
                  int off,
                  int len)
           throws IOException
Write some of the bytes from the given array to the stream.

Specified by:
write in interface DataOutput
Specified by:
write in interface ByteOutput
Overrides:
write in class ByteOutputStream
Parameters:
bytes - the byte array
off - the index to start writing from
len - the number of bytes to write
Throws:
IOException - if an error occurs

writeBoolean

public void writeBoolean(boolean v)
                  throws IOException

Specified by:
writeBoolean in interface DataOutput
Throws:
IOException

writeByte

public void writeByte(int v)
               throws IOException

Specified by:
writeByte in interface DataOutput
Throws:
IOException

writeShort

public void writeShort(int v)
                throws IOException

Specified by:
writeShort in interface DataOutput
Throws:
IOException

writeChar

public void writeChar(int v)
               throws IOException

Specified by:
writeChar in interface DataOutput
Throws:
IOException

writeInt

public void writeInt(int v)
              throws IOException

Specified by:
writeInt in interface DataOutput
Throws:
IOException

writeLong

public void writeLong(long v)
               throws IOException

Specified by:
writeLong in interface DataOutput
Throws:
IOException

writeFloat

public void writeFloat(float v)
                throws IOException

Specified by:
writeFloat in interface DataOutput
Throws:
IOException

writeDouble

public void writeDouble(double v)
                 throws IOException

Specified by:
writeDouble in interface DataOutput
Throws:
IOException

writeBytes

public void writeBytes(String s)
                throws IOException

Specified by:
writeBytes in interface DataOutput
Throws:
IOException

writeChars

public void writeChars(String s)
                throws IOException

Specified by:
writeChars in interface DataOutput
Throws:
IOException

writeUTF

public void writeUTF(String s)
              throws IOException

Specified by:
writeUTF in interface DataOutput
Throws:
IOException

flush

public void flush()
           throws IOException

Specified by:
flush in interface Flushable
Overrides:
flush in class ByteOutputStream
Throws:
IOException

shallowFlush

protected void shallowFlush()
                     throws IOException
This shallow flush will write the internal buffer out to the ByteOutput, but will not flush it.

Throws:
IOException - if an I/O error occurs

start

protected void start(ByteOutput byteOutput)
              throws IOException
Begin writing to a stream.

Parameters:
byteOutput - the new stream
Throws:
IOException - if an error occurs

finish

protected void finish()
               throws IOException
Finish writing to a stream. The stream is released. No further writing may be done until the start(ByteOutput) method is again invoked.

Throws:
IOException - if an error occurs

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Overrides:
close in class ByteOutputStream
Throws:
IOException

JBoss Marshalling 1.3.0.CR9

Copyright © 2011 JBoss, a division of Red Hat, Inc.