/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Resource Interchange File Format (RIFF) stream encoder.
*
* @author Karl Helgason
*/
private interface RandomAccessWriter {
}
}
}
}
return raf.getFilePointer();
}
}
}
}
}
}
}
}
byte[] s;
}
pos = (int) chunksizepointer;
}
return pos;
}
}
if (s == null)
s = new byte[1];
s[0] = (byte)b;
}
}
}
}
return length;
}
length = (int) i;
}
}
}
private final long chunksizepointer;
private final long startpointer;
private boolean open = true;
private boolean writeoverride = false;
}
}
}
throws IOException {
if (chunktype == 0)
if (chunktype == 0)
else if (chunktype == 1)
else
this.chunktype = 2;
writeUnsignedInt(0);
if (chunktype != 2)
}
}
return raf.getPointer();
}
this.writeoverride = writeoverride;
}
public boolean getWriteOverride() {
return writeoverride;
}
if (!open)
return;
if (childchunk != null) {
childchunk.close();
childchunk = null;
}
int bakchunktype = chunktype;
chunktype = 2;
if (bakchunktype == 0)
else
open = false;
}
if (!writeoverride) {
if (chunktype != 2) {
throw new IllegalArgumentException(
"Only chunks can write bytes!");
}
if (childchunk != null) {
childchunk.close();
childchunk = null;
}
}
}
if (!writeoverride) {
if (chunktype != 2) {
throw new IllegalArgumentException(
"Only chunks can write bytes!");
}
if (childchunk != null) {
childchunk.close();
childchunk = null;
}
}
}
if (chunktype == 2) {
throw new IllegalArgumentException(
"Only LIST and RIFF can write lists!");
}
if (childchunk != null) {
childchunk.close();
childchunk = null;
}
return childchunk;
}
if (chunktype == 2) {
throw new IllegalArgumentException(
"Only LIST and RIFF can write chunks!");
}
if (childchunk != null) {
childchunk.close();
childchunk = null;
}
return childchunk;
}
// Write ASCII chars to stream
}
// Write ASCII chars to stream
else {
write(0);
}
}
// Write 8 bit signed integer to stream
write(b);
}
// Write 16 bit signed integer to stream
}
// Write 32 bit signed integer to stream
}
// Write 64 bit signed integer to stream
}
// Write 8 bit unsigned integer to stream
writeByte((byte) b);
}
// Write 16 bit unsigned integer to stream
writeShort((short) b);
}
// Write 32 bit unsigned integer to stream
writeInt((int) b);
}
}