hep.io.xdr
Class XDROutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.DataOutputStream
hep.io.xdr.XDROutputStream
- All Implemented Interfaces:
- DataOutput, XDRDataOutput
- public class XDROutputStream
- extends DataOutputStream
- implements XDRDataOutput
A class for writing XDR files. Not too hard to do in Java since the XDR format is very
similar to the Java native DataStream format, except for String and the fact that elements
(ro an array of elements) are always padded to a multiple of 4 bytes.
This class requires the user to call the pad method, to skip to the next
4-byte boundary after writing an element or array of elements that may not
span a multiple of 4 bytes.
- Version:
- $Id: XDROutputStream.java,v 1.4 2003/09/16 23:11:55 tonyj Exp $
- Author:
- Tony Johnson (tonyj@slac.stanford.edu)
- Source Code:
- XDROutputStream.java
Methods inherited from class java.io.DataOutputStream |
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.DataOutput |
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
XDROutputStream
public XDROutputStream(OutputStream out)
writeString
public void writeString(String s)
throws IOException
- Description copied from interface:
XDRDataOutput
- Write a string preceeded by its (int) length
- Specified by:
writeString
in interface XDRDataOutput
- Throws:
IOException
writeStringChars
public void writeStringChars(String s)
throws IOException
- Description copied from interface:
XDRDataOutput
- Write a string (no length is written)
- Specified by:
writeStringChars
in interface XDRDataOutput
- Throws:
IOException
writeIntArray
public void writeIntArray(int[] array)
throws IOException
- Specified by:
writeIntArray
in interface XDRDataOutput
- Throws:
IOException
writeIntArray
public void writeIntArray(int[] array,
int start,
int n)
throws IOException
- Specified by:
writeIntArray
in interface XDRDataOutput
- Throws:
IOException
writeDoubleArray
public void writeDoubleArray(double[] array)
throws IOException
- Specified by:
writeDoubleArray
in interface XDRDataOutput
- Throws:
IOException
writeDoubleArray
public void writeDoubleArray(double[] array,
int start,
int n)
throws IOException
- Specified by:
writeDoubleArray
in interface XDRDataOutput
- Throws:
IOException
writeFloatArray
public void writeFloatArray(float[] array)
throws IOException
- Specified by:
writeFloatArray
in interface XDRDataOutput
- Throws:
IOException
writeFloatArray
public void writeFloatArray(float[] array,
int start,
int n)
throws IOException
- Specified by:
writeFloatArray
in interface XDRDataOutput
- Throws:
IOException
pad
public void pad()
throws IOException
- Skips appropriate amount to bring stream to 4-byte boundary.
- Specified by:
pad
in interface XDRDataOutput
- Throws:
IOException
getBytesWritten
public long getBytesWritten()
Copyright © 2000-2004 FreeHEP, All Rights Reserved.