java.io

Interface DataOutput

Known Subinterfaces:
ImageOutputStream, ObjectOutput, RandomAccessContent
Known Implementing Classes:
AbstractRandomAccessContent, AbstractRandomAccessStreamContent, DataOutputStream, FileCacheImageOutputStream, FileImageOutputStream, ImageOutputStreamImpl, JRAbstractLRUVirtualizer.ClassLoaderAnnotationObjectOutputStream, MemoryCacheImageOutputStream, MonitorRandomAccessContent, ObjectOutputStream, RamFileRandomAccessContent, RandomAccessFile

public interface DataOutput

The DataOutput interface provides for converting data from any of the Java primitive types to a series of bytes and writing these bytes to a binary stream. There is also a facility for converting a String into modified UTF-8 format and writing the resulting series of bytes.

For all the methods in this interface that write bytes, it is generally true that if a byte cannot be written for any reason, an IOException is thrown.

Since:
JDK1.0
See Also:
DataInput, DataOutputStream

Method Summary

void
write(b[] )
Writes to the output stream all the bytes in array b.
void
write(b[] , int off, int len)
Writes len bytes from array b, in order, to the output stream.
void
write(int b)
Writes to the output stream the eight low-order bits of the argument b.
void
writeBoolean(boolean v)
Writes a boolean value to this output stream.
void
writeByte(int v)
Writes to the output stream the eight low- order bits of the argument v.
void
writeBytes(String s)
Writes a string to the output stream.
void
writeChar(int v)
Writes a char value, which is comprised of two bytes, to the output stream.
void
writeChars(String s)
Writes every character in the string s, to the output stream, in order, two bytes per character.
void
writeDouble(double v)
Writes a double value, which is comprised of eight bytes, to the output stream.
void
writeFloat(float v)
Writes a float value, which is comprised of four bytes, to the output stream.
void
writeInt(int v)
Writes an int value, which is comprised of four bytes, to the output stream.
void
writeLong(long v)
Writes a long value, which is comprised of eight bytes, to the output stream.
void
writeShort(int v)
Writes two bytes to the output stream to represent the value of the argument.
void
writeUTF(String str)
Writes two bytes of length information to the output stream, followed by the modified UTF-8 representation of every character in the string s.

Method Details

write

public void write(b[] )
            throws IOException
Writes to the output stream all the bytes in array b. If b is null, a NullPointerException is thrown. If b.length is zero, then no bytes are written. Otherwise, the byte b[0] is written first, then b[1], and so on; the last byte written is b[b.length-1].
Parameters:
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of write(b[] )
   1: import java.io.IOException;
   2: import java.io.DataOutput;
   3: import java.io.DataInput;
   4:         ...
   5: 
   6:     public static void write(DataOutput out, MotorBufferData data) throws IOException{        
   7:         boolean[] mask = data.getMask();
   8:         ...
   9:         
  10:         out.write(SIGNATURE);
  11:             

View Full Code Here
   1: 
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5:     
   6:     private DataOutput out;
   7: 
   8:         ...
   9:         if ((length & 1) != 0)
  10:             out.write(VRs.getPadding(vr));
  11:     }
  12:         ...
  13:         if ((length & 1) != 0)
  14:             out.write(0);

View Full Code Here
   1: import java.io.DataInputStream;
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5: 
   6:     public void marshal(Object command, DataOutput os) throws IOException {
   7:         StompFrame stomp = (org.apache.activemq.transport.stomp.StompFrame) command;
   8:         ...
   9: 
  10:         os.write(buffer.toString().getBytes("UTF-8"));
  11:         ...
  12:         os.write(stomp.getContent());

View Full Code Here
   1: import java.io.DataInputStream;
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5:     
   6:     private void writeHeader( DataOutput out ) throws IOException {
   7:         ...
   8:         out.write(START_OF_RECORD);
   9:         out.writeByte(recordType);
  10:         ...
  11:     
  12:     private void writeFooter( DataOutput out ) throws IOException {

View Full Code Here
   1:     RandomAccessFile out = new RandomAccessFile(indexFile, "rw");
   2:     out.write(k1);
   3:         ...
   4:     documents.write(out);
   5:         ...
   6:     out.write(k2);
   7:     offsets.write(out);
   8:         ...
   9: 
  10:   private void writeOut(DataOutput out) throws java.io.IOException

View Full Code Here

write

public void write(b[] ,
                  int off,
                  int len)
            throws IOException
Writes len bytes from array b, in order, to the output stream. If b is null, a NullPointerException is thrown. If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown. If len is zero, then no bytes are written. Otherwise, the byte b[off] is written first, then b[off+1], and so on; the last byte written is b[off+len-1].
Parameters:
off - the start offset in the data.
len - the number of bytes to write.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of write(b[] ,int off,int len)
   1:     private Checksum cksum;
   2:     private DataOutput out;
   3: 
   4:         ...
   5:     public CheckedDataOutput(DataOutput out, Checksum cksum) {
   6:         this.cksum = cksum;
   7:         ...
   8:     public void write(byte[] b) throws IOException {
   9:         out.write(b, 0, b.length);
  10:         cksum.update(b, 0, b.length);
  11:         ...
  12:     public void write(byte[] b, int off, int len) throws IOException {
  13:         out.write(b, off, len);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:    
   6:    public void flattenMessage(DataOutput out, Message msg) throws IOException 
   7:    {
   8:         ...
   9:       out.writeInt(flatSize);
  10:       out.write(compressed, 0, _deflateStream.next_out_index);
  11:       _outputByteBuffer.reset();

View Full Code Here
   1: package components;
   2: import java.io.DataOutput;
   3: import java.io.DataInput;
   4:         ...
   5:     protected int
   6:     writeData( DataOutput o ) throws IOException{
   7:     int trueLength = 8 + code.length;
   8:         ...
   9:     o.writeInt( code.length );
  10:     o.write( code, 0, code.length );
  11:     if ( exceptionTable == null ){

View Full Code Here
   1: import java.io.ByteArrayOutputStream;
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5: 
   6:         synchronized void writeTo(DataOutput data, int size) throws IOException
   7:         {
   8:         ...
   9: 
  10:             data.write(buf, 0, size);
  11:         }
  12:         ...
  13: 
  14:     public void writeTo(DataOutput data, int size) throws IOException

View Full Code Here
   1: 
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5:     
   6:     private DataOutput out;
   7: 
   8:         ...
   9:         if (preamble != null) {
  10:             out.write(preamble, 0, 128);
  11:         ...
  12:             out.write(FileMetaInfoImpl.DICM_PREFIX, 0, 4);

View Full Code Here

write

public void write(int b)
            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.
Parameters:
b - the byte to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of write(int b)
   1: import java.io.IOException;
   2: import java.io.DataOutput;
   3: import java.io.DataInput;
   4:         ...
   5: 
   6:     public static void write(DataOutput out, MotorBufferData data) throws IOException{        
   7:         boolean[] mask = data.getMask();
   8:         ...
   9:         
  10:         out.write(SIGNATURE);
  11:             

View Full Code Here
   1: 
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5:     
   6:     private DataOutput out;
   7: 
   8:         ...
   9:         if ((length & 1) != 0)
  10:             out.write(VRs.getPadding(vr));
  11:     }
  12:         ...
  13:         if ((length & 1) != 0)
  14:             out.write(0);

View Full Code Here
   1: import java.io.DataInputStream;
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5: 
   6:     public void marshal(Object command, DataOutput os) throws IOException {
   7:         StompFrame stomp = (org.apache.activemq.transport.stomp.StompFrame) command;
   8:         ...
   9: 
  10:         os.write(buffer.toString().getBytes("UTF-8"));
  11:         ...
  12:         os.write(stomp.getContent());

View Full Code Here
   1: import java.io.DataInputStream;
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5:     
   6:     private void writeHeader( DataOutput out ) throws IOException {
   7:         ...
   8:         out.write(START_OF_RECORD);
   9:         out.writeByte(recordType);
  10:         ...
  11:     
  12:     private void writeFooter( DataOutput out ) throws IOException {

View Full Code Here
   1:     RandomAccessFile out = new RandomAccessFile(indexFile, "rw");
   2:     out.write(k1);
   3:         ...
   4:     documents.write(out);
   5:         ...
   6:     out.write(k2);
   7:     offsets.write(out);
   8:         ...
   9: 
  10:   private void writeOut(DataOutput out) throws java.io.IOException

View Full Code Here

writeBoolean

public void writeBoolean(boolean v)
            throws IOException
Writes a boolean value to this output stream. If the argument v is true, the value (byte)1 is written; if v is false, the value (byte)0 is written. The byte written by this method may be read by the readBoolean method of interface DataInput, which will then return a boolean equal to v.
Parameters:
v - the boolean to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeBoolean(boolean v)
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:         int rc = super.tightMarshal1(wireFormat, o, bs);
   6:         bs.writeBoolean(info.isClose());
   7:         rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs);
   8:         ...
   9: 
  10:     public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
  11:         super.tightMarshal2(wireFormat, o, dataOut, bs);
  12:         ...
  13: 
  14:     public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:         rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getTransactionId(), bs);
   6:         bs.writeBoolean(info.getWasPrepared());
   7: 
   8:         ...
   9: 
  10:     public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
  11:         super.tightMarshal2(wireFormat, o, dataOut, bs);
  12:         ...
  13: 
  14:     public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:         rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getTransactionId(), bs);
   6:         bs.writeBoolean(info.getWasPrepared());
   7: 
   8:         ...
   9: 
  10:     public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
  11:         super.tightMarshal2(wireFormat, o, dataOut, bs);
  12:         ...
  13: 
  14:     public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:         int rc = super.tightMarshal1(wireFormat, o, bs);
   6:         bs.writeBoolean(info.isClose());
   7:         ...
   8:         bs.writeBoolean(info.isExit());
   9:         ...
  10:         bs.writeBoolean(info.isFaultTolerant());

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:         int rc = super.tightMarshal1(wireFormat, o, bs);
   6:         bs.writeBoolean(info.isClose());
   7:         ...
   8:         bs.writeBoolean(info.isExit());
   9:         ...
  10:         bs.writeBoolean(info.isFaultTolerant());

View Full Code Here

writeByte

public void writeByte(int v)
            throws IOException
Writes to the output stream the eight low- order bits of the argument v. The 24 high-order bits of v are ignored. (This means that writeByte does exactly the same thing as write for an integer argument.) The byte written by this method may be read by the readByte method of interface DataInput, which will then return a byte equal to (byte)v.
Parameters:
v - the byte value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeByte(int v)
   1:   
   2:   public void write(DataOutput out) throws IOException
   3:   {
   4:         ...
   5:     while (bytes-- > 0)
   6:       out.writeByte((word >>> (shift -= BitsInByte)) & 0xFF);
   7:   }
   8: 
   9:   public void clear()

View Full Code Here
   1: 
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     protected DataOutput output;
   7: 
   8:         ...
   9:         if (number >= 0 && number < 0xff) {
  10:             output.writeByte(number);
  11:         } else {
  12:         ...
  13:             output.writeByte(0xff);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writeToStream(DataOutput dataOut) throws IOException {
   7:         ...
   8:         dataOut.writeByte(length);
   9:         if (length <= BYTE_SIZE) {
  10:         ...
  11:             dataOut.writeByte((int) bits);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writeToStream(DataOutput dataOut) throws IOException {
   7:         ...
   8:         dataOut.writeByte(length);
   9:         if (length <= BYTE_SIZE) {
  10:         ...
  11:             dataOut.writeByte((int) bits);

View Full Code Here
   1: package components;
   2: import java.io.DataOutput;
   3: import java.io.DataInput;
   4:         ...
   5: 
   6:     public int writeData(DataOutput out) throws IOException {
   7:     out.writeShort(offset);
   8:         ...
   9: 
  10:     public int writeData(DataOutput out, ConstantObject[] table) 
  11:        throws IOException 
  12:         ...
  13:         if (value < 0) { 
  14:             out.writeByte(ITEM_NewObject);

View Full Code Here

writeBytes

public void writeBytes(String s)
            throws IOException
Writes a string to the output stream. For every character in the string s, taken in order, one byte is written to the output stream. If s is null, a NullPointerException is thrown.

If s.length is zero, then no bytes are written. Otherwise, the character s[0] is written first, then s[1], and so on; the last character written is s[s.length-1]. For each character, one byte is written, the low-order byte, in exactly the manner of the writeByte method . The high-order eight bits of each character in the string are ignored.

Parameters:
s - the string of bytes to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeBytes(String s)
   1: 
   2: import java.io.DataOutput;
   3: 
   4:         ...
   5: 
   6:         DataOutput out = new DataOutputStream(output);
   7: 
   8:         ...
   9:         DataOutput log = new DataOutputStream(System.out);
  10: 
  11:         ...
  12: 
  13:         out.writeBytes(HTTP_VERSION);

View Full Code Here
   1:     }
   2:     public void writeClass (DataOutput dos) throws IOException {
   3:     int i;
   4:         ...
   5:         for (i=0; i<cards.length; i += 1) {
   6:         dos.writeBytes(cards[i]);
   7:         }
   8:         ...
   9:         for (i=0; i<4*pad; i += 1) {
  10:             dos.writeBytes("                    ");
  11:         }

View Full Code Here
   1: import java.io.DataInputStream;
   2: import java.io.DataOutput;
   3: import java.io.DataOutputStream;
   4:         ...
   5: 
   6:     public Command writeCommand(final Command packet, final DataOutput out) throws IOException, JMSException {
   7:         flushPendingFrames(out);
   8:         ...
   9: 
  10:     private void flushPendingFrames(final DataOutput out) throws IOException {
  11:         boolean interrupted = false;
  12:         ...
  13:                         buffer.append(Stomp.NULL);
  14:                         out.writeBytes(buffer.toString());

View Full Code Here

writeChar

public void writeChar(int v)
            throws IOException
Writes a char value, which is comprised of two bytes, to the output stream. The byte values to be written, in the order shown, are:


 (byte)(0xff & (v >> 8))
 (byte)(0xff & v)
 

The bytes written by this method may be read by the readChar method of interface DataInput , which will then return a char equal to (char)v.

Parameters:
v - the char value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeChar(int v)
   1:             if (nargs == 2){
   2:                 DataOutput dout = (DataOutput)args[0];
   3:                 char value = ((Character)args[1]).charValue();
   4:         ...
   5:                 dout.writeChar(value);
   6:                 return new Integer(1);
   7:         ...
   8:             } else if (nargs == 4){
   9:                 DataOutput dout = (DataOutput)args[0];
  10:                 char[] src = (char[])args[1];
  11:         ...
  12:                 for (int i = 0; i < n; i++){
  13:                     dout.writeChar(src[offset + i]);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void write(Object value, DataOutput out) throws IOException {
   7:         if(null == value) {
   8:         ...
   9:             out.writeChar(Character.MIN_VALUE);
  10:             out.writeBoolean(false);
  11:         ...
  12:             char val = ((Character)(convert(value))).charValue();
  13:             out.writeChar(val);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:         public void writeData(@NotNull DataOutput out) throws IOException {
   7:             out.writeUTF(key);
   8:         ...
   9: 
  10:         public void writeData(@NotNull DataOutput out) throws IOException {
  11:             out.writeLong(key);
  12:         ...
  13:             out.writeDouble(value8);
  14:             out.writeChar(value9);

View Full Code Here
   1: 
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:   @Override
   6:   public void toStream(int fromIndex, int toIndex, DataOutput dest) throws IOException
   7:   {
   8:         ...
   9:     if (toIndex - fromIndex == 1)
  10:       dest.writeChar(get(fromIndex));
  11:     else if (fromIndex != toIndex)

View Full Code Here
   1: out.println("import java.io.DataInput;");
   2: out.println("import java.io.DataOutput;");
   3: out.println("import java.io.IOException;");
   4:         ...
   5: out.println("");
   6: out.println("    public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {");
   7: out.println("        super.tightMarshal2(wireFormat, o, dataOut, bs);");
   8:         ...
   9: out.println("");
  10: out.println("    public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {");
  11: 
  12:         ...
  13:             } else if (type.equals("char")) {
  14:                 out.println("        dataOut.writeChar(" + getter + ");");

View Full Code Here

writeChars

public void writeChars(String s)
            throws IOException
Writes every character in the string s, to the output stream, in order, two bytes per character. If s is null, a NullPointerException is thrown. If s.length is zero, then no characters are written. Otherwise, the character s[0] is written first, then s[1], and so on; the last character written is s[s.length-1]. For each character, two bytes are actually written, high-order byte first, in exactly the manner of the writeChar method.
Parameters:
s - the string value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeChars(String s)
   1:             if (nargs == 2){
   2:                 DataOutput dout = (DataOutput)args[0];
   3:                 String str = (String)args[1];
   4:         ...
   5:                 dout.writeChars(str);
   6:             } else {
   7:         ...
   8:     public String toString(){
   9:         return "function writeChars(DataOutput dout, String str)";
  10:     }

View Full Code Here

writeDouble

public void writeDouble(double v)
            throws IOException
Writes a double value, which is comprised of eight bytes, to the output stream. It does this as if it first converts this double value to a long in exactly the manner of the Double.doubleToLongBits method and then writes the long value in exactly the manner of the writeLong method. The bytes written by this method may be read by the readDouble method of interface DataInput, which will then return a double equal to v.
Parameters:
v - the double value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeDouble(double v)
   1:             if (nargs == 2){
   2:                 DataOutput dout = (DataOutput)args[0];
   3:                 double value = ((Double)args[1]).doubleValue();
   4:         ...
   5:                 dout.writeDouble(value);
   6:                 return new Integer(1);
   7:         ...
   8:             } else if (nargs == 4){
   9:                 DataOutput dout = (DataOutput)args[0];
  10:                 double[] src = (double[])args[1];
  11:         ...
  12:                 for (int i = 0; i < n; i++){
  13:                     dout.writeDouble(src[offset + i]);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writeData(@NotNull DataOutput out) throws IOException {
   7:         ...
   8:         out.writeDouble(ask);
   9:         ...
  10:         out.writeDouble(bid);

View Full Code Here
   1: 
   2:     public void writeTo(DataOutput dout) throws IOException {
   3:         super.writeTo(dout);
   4:         ...
   5:         dout.writeDouble(mValue.doubleValue());
   6:     }
   7: 
   8:     public String toString() {

View Full Code Here
   1: 
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:   @Override
   6:   public int toStream(DataOutput dest) throws IOException
   7:   {
   8:         ...
   9:       for (DoubleIterator it = iterator(); remaining-- > 0;)
  10:         dest.writeDouble(it.next());
  11:     }

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:         public void writeData(@NotNull DataOutput out) throws IOException {
   7:             out.writeUTF(key);
   8:         ...
   9: 
  10:         public void writeData(@NotNull DataOutput out) throws IOException {
  11:             out.writeLong(key);
  12:         ...
  13:             out.writeFloat(value7);
  14:             out.writeDouble(value8);

View Full Code Here

writeFloat

public void writeFloat(float v)
            throws IOException
Writes a float value, which is comprised of four bytes, to the output stream. It does this as if it first converts this float value to an int in exactly the manner of the Float.floatToIntBits method and then writes the int value in exactly the manner of the writeInt method. The bytes written by this method may be read by the readFloat method of interface DataInput, which will then return a float equal to v.
Parameters:
v - the float value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeFloat(float v)
   1:             if (nargs == 2){
   2:                 DataOutput dout = (DataOutput)args[0];
   3:                 float value = ((Float)args[1]).floatValue();
   4:         ...
   5:                 dout.writeFloat(value);
   6:                 return new Integer(1);
   7:         ...
   8:             } else if (nargs == 4){
   9:                 DataOutput dout = (DataOutput)args[0];
  10:                 float[] src = (float[])args[1];
  11:         ...
  12:                 for (int i = 0; i < n; i++){
  13:                     dout.writeFloat(src[offset + i]);

View Full Code Here
   1: 
   2:     public void writeTo(DataOutput dout) throws IOException {
   3:         super.writeTo(dout);
   4:         ...
   5:         dout.writeFloat(mValue.floatValue());
   6:     }
   7: 
   8:     public String toString() {

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void write(Object value, DataOutput out) throws IOException {
   7:         if(null == value) {
   8:         ...
   9:             out.writeFloat(Float.MIN_VALUE);
  10:             out.writeBoolean(false);
  11:         ...
  12:             float val = ((Float)(convert(value))).floatValue();
  13:             out.writeFloat(val);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:         public void writeData(@NotNull DataOutput out) throws IOException {
   7:             out.writeUTF(key);
   8:         ...
   9: 
  10:         public void writeData(@NotNull DataOutput out) throws IOException {
  11:             out.writeLong(key);
  12:         ...
  13:             out.writeLong(value6);
  14:             out.writeFloat(value7);

View Full Code Here
   1: import java.nio.FloatBuffer;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:   public int toStream(DataOutput dest) throws IOException
   7:   {
   8:         ...
   9:       for (FloatIterator it = iterator(); rem-- > 0;)
  10:         dest.writeFloat(it.next());
  11:     }

View Full Code Here

writeInt

public void writeInt(int v)
            throws IOException
Writes an int value, which is comprised of four bytes, to the output stream. The byte values to be written, in the order shown, are:


 (byte)(0xff & (v >> 24))
 (byte)(0xff & (v >> 16))
 (byte)(0xff & (v >>    8))
 (byte)(0xff & v)
 

The bytes written by this method may be read by the readInt method of interface DataInput , which will then return an int equal to v.

Parameters:
v - the int value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeInt(int v)
   1: package org.activemq.io.impl;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
   7:         super.writePacket(packet, dataOut);
   8:         ...
   9:         dataOut.writeByte(info.getCapacity());
  10:         dataOut.writeInt((int)info.getFlowControlTimeout());
  11:     }

View Full Code Here
   1: package org.codehaus.activemq.io.impl;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
   7:         super.writePacket(packet, dataOut);
   8:         ...
   9:         dataOut.writeByte(info.getCapacity());
  10:         dataOut.writeInt((int)info.getFlowControlTimeout());
  11:     }

View Full Code Here
   1: package org.activemq.io.impl;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
   7:         MessageAck ack = (MessageAck) packet;
   8:         ...
   9:             }else {
  10:                 dataOut.writeInt((int)ack.getSequenceNumber());
  11:             }

View Full Code Here
   1: package org.codehaus.activemq.io.impl;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
   7:         MessageAck ack = (MessageAck) packet;
   8:         ...
   9:             }else {
  10:                 dataOut.writeInt((int)ack.getSequenceNumber());
  11:             }

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writeToStream(DataOutput dataOut) throws IOException {
   7:         dataOut.writeByte(length);
   8:         ...
   9:         else if (length <= INT_SIZE) {
  10:             dataOut.writeInt((int) bits);
  11:         }

View Full Code Here

writeLong

public void writeLong(long v)
            throws IOException
Writes a long value, which is comprised of eight bytes, to the output stream. The byte values to be written, in the order shown, are:


 (byte)(0xff & (v >> 56))
 (byte)(0xff & (v >> 48))
 (byte)(0xff & (v >> 40))
 (byte)(0xff & (v >> 32))
 (byte)(0xff & (v >> 24))
 (byte)(0xff & (v >> 16))
 (byte)(0xff & (v >>  8))
 (byte)(0xff & v)
 

The bytes written by this method may be read by the readLong method of interface DataInput , which will then return a long equal to v.

Parameters:
v - the long value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeLong(long v)
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.File;
   4:         ...
   5: 
   6:     public void write(DataOutput out) throws IOException {
   7:         ...
   8:         out.writeLong(_offset);
   9:         out.writeInt(_length);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writeToStream(DataOutput dataOut) throws IOException {
   7:         dataOut.writeByte(length);
   8:         ...
   9:         else {
  10:             dataOut.writeLong(bits);
  11:         }

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void writeToStream(DataOutput dataOut) throws IOException {
   7:         dataOut.writeByte(length);
   8:         ...
   9:         else {
  10:             dataOut.writeLong(bits);
  11:         }

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:     
   6:     static void writeExternal (final ClassDescriptor cls, final DataOutput out)
   7:         throws IOException
   8:         ...
   9:         
  10:         out.writeLong(cls.m_stamp);
  11:         

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:     
   6:     static void writeExternal (final CoverageData cdata, final DataOutput out)
   7:         throws IOException
   8:         ...
   9:             out.writeUTF (classVMName);
  10:             out.writeLong(data.m_stamp);
  11:             

View Full Code Here

writeShort

public void writeShort(int v)
            throws IOException
Writes two bytes to the output stream to represent the value of the argument. The byte values to be written, in the order shown, are:


 (byte)(0xff & (v >> 8))
 (byte)(0xff & v)
  

The bytes written by this method may be read by the readShort method of interface DataInput , which will then return a short equal to (short)v.

Parameters:
v - the short value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeShort(int v)
   1: package components;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void write( DataOutput o ) throws IOException {
   7:         ...
   8:     o.writeShort( startPC );
   9:         ...
  10:     o.writeShort( endPC );

View Full Code Here
   1: 
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:     
   6:     public static void writeTags(DataOutput out, Tag tags[])
   7:         throws IOException
   8:         ...
   9:             {
  10:                 out.writeShort(1);
  11:                 out.write(tags[i].ident);
  12:         ...
  13:             {
  14:                 out.writeShort(tags[i].name.length());

View Full Code Here
   1: 
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void write(DataOutput o) throws IOException {
   7:     if (innerInfo != null) {
   8:         ...
   9:         o.writeShort(innerInfo.index);
  10:     } else {
  11:         ...
  12:         o.writeShort(0);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     protected synchronized void write(final DataOutput ostream)
   7:         throws IOException {
   8:         ...
   9:         ostream.writeShort(max);
  10:         ...
  11:         ostream.writeShort(nextPartition);

View Full Code Here
   1: package components;
   2: import java.io.DataOutput;
   3: import java.io.DataInput;
   4:         ...
   5:     protected int
   6:     writeData( DataOutput o ) throws IOException{
   7:     int trueLength = 8 + code.length;
   8:         ...
   9:     o.writeShort( stack );
  10:         ...
  11:     o.writeShort( locals );

View Full Code Here

writeUTF

public void writeUTF(String str)
            throws IOException
Writes two bytes of length information to the output stream, followed by the modified UTF-8 representation of every character in the string s. If s is null, a NullPointerException is thrown. Each character in the string s is converted to a group of one, two, or three bytes, depending on the value of the character.

If a character c is in the range \u0001 through \u007f, it is represented by one byte:

(byte)c 

If a character c is \u0000 or is in the range \u0080 through \u07ff, then it is represented by two bytes, to be written in the order shown:


 (byte)(0xc0 | (0x1f & (c >> 6)))
 (byte)(0x80 | (0x3f & c))
  

If a character c is in the range \u0800 through uffff, then it is represented by three bytes, to be written in the order shown:


 (byte)(0xe0 | (0x0f & (c >> 12)))
 (byte)(0x80 | (0x3f & (c >>  6)))
 (byte)(0x80 | (0x3f & c))
  

First, the total number of bytes needed to represent all the characters of s is calculated. If this number is larger than 65535, then a UTFDataFormatException is thrown. Otherwise, this length is written to the output stream in exactly the manner of the writeShort method; after this, the one-, two-, or three-byte representation of each character in the string s is written.

The bytes written by this method may be read by the readUTF method of interface DataInput , which will then return a String equal to s.

Parameters:
str - the string value to be written.
Throws:
IOException - if an I/O error occurs.
Usages and Demos :

View More Examples of writeUTF(String str)
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: public class StringMarshaller implements Marshaller{
   6:     public void writePayload(Object object,DataOutput dataOut) throws IOException{
   7:         ...
   8:         dataOut.writeUTF(object.toString());
   9:     }

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.File;
   4:         ...
   5: 
   6:     public void write(DataOutput out) throws IOException {
   7:         ...
   8:         out.writeUTF(_directoryName);
   9:         ...
  10:         out.writeUTF(_fileName);

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     protected synchronized void write(final DataOutput ostream)
   7:         throws IOException {
   8:         ...
   9:             final Object2IntMap.Entry entry = (Object2IntMap.Entry) i.next();
  10:             ostream.writeUTF((String) entry.getKey());
  11:             ostream.writeShort((short) entry.getIntValue());
  12:         ...
  13:             final Object2IntMap.Entry entry = (Object2IntMap.Entry) i.next();
  14:             ostream.writeUTF((String) entry.getKey());

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void write(Object value, DataOutput out) throws IOException {
   7:         if(null == value) {
   8:         ...
   9:             out.writeUTF("null");
  10:             out.writeBoolean(false);
  11:         ...
  12:         } else if("null".equals(value)) {
  13:             out.writeUTF("null");

View Full Code Here
   1: import java.io.DataInput;
   2: import java.io.DataOutput;
   3: import java.io.IOException;
   4:         ...
   5:     
   6:     static void writeExternal (final ClassDescriptor cls, final DataOutput out)
   7:         throws IOException
   8:         ...
   9:     {
  10:         out.writeUTF(cls.m_packageVMName);
  11:         ...
  12:         out.writeUTF(cls.m_name);

View Full Code Here