001: /*
002: * $RCSfile: J3fOutputStream.java,v $
003: *
004: * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions
008: * are met:
009: *
010: * - Redistribution of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: *
013: * - Redistribution in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in
015: * the documentation and/or other materials provided with the
016: * distribution.
017: *
018: * Neither the name of Sun Microsystems, Inc. or the names of
019: * contributors may be used to endorse or promote products derived
020: * from this software without specific prior written permission.
021: *
022: * This software is provided "AS IS," without a warranty of any
023: * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
024: * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
025: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
026: * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL
027: * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
028: * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
029: * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
030: * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
031: * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
032: * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
033: * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
034: * POSSIBILITY OF SUCH DAMAGES.
035: *
036: * You acknowledge that this software is not designed, licensed or
037: * intended for use in the design, construction, operation or
038: * maintenance of any nuclear facility.
039: *
040: * $Revision: 1.4 $
041: * $Date: 2007/02/09 17:20:28 $
042: * $State: Exp $
043: */
044:
045: package com.sun.j3d.utils.scenegraph.io.retained;
046:
047: import java.io.DataOutputStream;
048: import java.io.IOException;
049:
050: /**
051: * J3fOutputStream class for SceneGraph I/O.
052: */
053: public class J3fOutputStream implements java.io.DataOutput {
054:
055: private PositionOutputStream positionOutputStream;
056: private DataOutputStream dataOutputStream;
057:
058: /** Creates new J3fInputStream */
059: public J3fOutputStream(java.io.OutputStream stream) {
060: positionOutputStream = new PositionOutputStream(stream);
061: dataOutputStream = new DataOutputStream(positionOutputStream);
062: }
063:
064: /**
065: * Move the file pointer to the specified position.
066: * The position MUST be greater or equal to the current position
067: */
068: public void seekForward(long position) throws IOException {
069: positionOutputStream.seekForward(position);
070: }
071:
072: public long getFilePointer() {
073: return positionOutputStream.getFilePointer();
074: }
075:
076: public void write(byte[] p1, int p2, int p3)
077: throws java.io.IOException {
078: dataOutputStream.write(p1, p2, p3);
079: }
080:
081: public void writeFloat(float p1) throws java.io.IOException {
082: dataOutputStream.writeFloat(p1);
083: }
084:
085: public void write(int p1) throws java.io.IOException {
086: dataOutputStream.write(p1);
087: }
088:
089: public void writeShort(int p1) throws java.io.IOException {
090: dataOutputStream.writeShort(p1);
091: }
092:
093: public void writeBytes(java.lang.String p1)
094: throws java.io.IOException {
095: dataOutputStream.writeBytes(p1);
096: }
097:
098: public void writeChar(int p1) throws java.io.IOException {
099: dataOutputStream.writeChar(p1);
100: }
101:
102: public void writeByte(int p1) throws java.io.IOException {
103: dataOutputStream.writeByte(p1);
104: }
105:
106: public void writeLong(long p1) throws java.io.IOException {
107: dataOutputStream.writeLong(p1);
108: }
109:
110: public void writeBoolean(boolean p1) throws java.io.IOException {
111: dataOutputStream.writeBoolean(p1);
112: }
113:
114: public void writeUTF(java.lang.String p1)
115: throws java.io.IOException {
116: dataOutputStream.writeUTF(p1);
117: }
118:
119: public void writeInt(int p1) throws java.io.IOException {
120: dataOutputStream.writeInt(p1);
121: }
122:
123: public void writeChars(java.lang.String p1)
124: throws java.io.IOException {
125: dataOutputStream.writeChars(p1);
126: }
127:
128: public void write(byte[] p1) throws java.io.IOException {
129: dataOutputStream.write(p1);
130: }
131:
132: public void writeDouble(double p1) throws java.io.IOException {
133: dataOutputStream.writeDouble(p1);
134: }
135:
136: }
|