this.flags = RcRiffFile.readUnsignedInt(in); bytesRead += 4; this.sampleOffset = RcRiffFile.read64BitUnsignedInt(in); bytesRead += 8; this.byteOffset = RcRiffFile.read64BitUnsignedInt(in); bytesRead += 8; this.intraSampleOffset = RcRiffFile.read64BitUnsignedInt(in); bytesRead += 8; this.labelText = RcRiffFile.readUtf8(in, 256); this.labelText = RcRiffFile.readAscii(in, 256); this.labelChunkIdentifier = RcRiffFile.readUnsignedInt(in); bytesRead += 4; this.userData1 = RcRiffFile.readUnsignedInt(in); bytesRead += 4; this.userData2 = RcRiffFile.readUnsignedInt(in); bytesRead += 4; this.userData3 = RcRiffFile.readUnsignedInt(in); bytesRead += 4; this.userData4 = RcRiffFile.readUnsignedInt(in);
bytesWritten += RcRiffFile.writeUnsignedInt(out, this.flags); bytesWritten += RcRiffFile.write64BitUnsignedInt(out, this.sampleOffset); bytesWritten += RcRiffFile.write64BitUnsignedInt(out, this.byteOffset); bytesWritten += RcRiffFile.write64BitUnsignedInt(out, this.intraSampleOffset); " bytes)."); long labelTextBytesWritten = RcRiffFile.writeUtf8(out, this.labelText); RcRiffFile.writeNullBytes(out, 256 - labelTextBytesWritten); bytesWritten += 256; bytesWritten += RcRiffFile.writeUnsignedInt(out, this.labelChunkIdentifier); RcRiffFile.writeUnsignedInt(out, this.userData1); bytesWritten += 4; RcRiffFile.writeUnsignedInt(out, this.userData2); bytesWritten += 4; RcRiffFile.writeUnsignedInt(out, this.userData3); bytesWritten += 4; RcRiffFile.writeUnsignedInt(out, this.userData4); bytesWritten += 4;
private long writeStringChunk(RandomAccessFile out, String id, String value) throws UnsupportedEncodingException, IOException { long bytesWritten = 0L; bytesWritten += RcRiffFile.writeAscii(out, id); bytesWritten += RcRiffFile.writeUnsignedInt(out, value.length() + 1); bytesWritten += RcRiffFile.writeAscii(out, value); bytesWritten += RcRiffFile.writeNullBytes(out, 1); bytesWritten += this.align(out, bytesWritten); return bytesWritten; }
chunkDataSize += RcRiffFile.writeAscii( out, this.getDescription().trim()); chunkDataSize += RcRiffFile.writeNullBytes( out, RcRiffBextChunk.DESCRIPTION_LENGTH - chunkDataSize += RcRiffFile.writeNullBytes( out, RcRiffBextChunk.DESCRIPTION_LENGTH); chunkDataSize += RcRiffFile.writeAscii( out, this.getOriginator().trim()); chunkDataSize += RcRiffFile.writeNullBytes( out, RcRiffBextChunk.ORIGINATOR_LENGTH - chunkDataSize += RcRiffFile.writeNullBytes( out, RcRiffBextChunk.ORIGINATOR_LENGTH); chunkDataSize += RcRiffFile.writeAscii( out, this.getOriginatorReference().trim()); chunkDataSize += RcRiffFile.writeNullBytes(
public long write(RandomAccessFile out) throws IOException, RcBwfException { String exPrefix = "Unable to write RIFF chunk - "; if (this.getChunkId() == null) { throw new IOException( exPrefix + "chunk id is null"); } if (this.getChunkId().length() != RcRiffChunk.SIZE_OF_CHUNK_ID) { throw new IOException( exPrefix + "chunk id must be " + RcRiffChunk.SIZE_OF_CHUNK_ID + " characters in length."); } long chunkHeaderSize = 0L; // Write chunk id //System.out.println("Writing " + this.getChunkId() + " at " + out.getFilePointer()); chunkHeaderSize += RcRiffFile.writeAscii(out, this.getChunkId()); // Write chunk size //System.out.println("Writing " + this.getChunkSize() + " at " + out.getFilePointer()); chunkHeaderSize += RcRiffFile.writeUnsignedInt(out, this.getChunkSize()); return chunkHeaderSize; }
this.setFormatTag(RcRiffFile.readUnsignedShort(in)); bytesRead += RcRiffFile.SIZE_OF_UNSIGNED_SHORT; this.setChannels(RcRiffFile.readUnsignedShort(in)); bytesRead += RcRiffFile.SIZE_OF_UNSIGNED_SHORT; this.setSamplesPerSec(RcRiffFile.readUnsignedInt(in)); bytesRead += RcRiffFile.SIZE_OF_UNSIGNED_INT; this.setAvgBytesPerSec(RcRiffFile.readUnsignedInt(in)); bytesRead += RcRiffFile.SIZE_OF_UNSIGNED_INT; this.setBlockAlign(RcRiffFile.readUnsignedShort(in)); bytesRead += RcRiffFile.SIZE_OF_UNSIGNED_SHORT; this.setBitsPerSample(RcRiffFile.readUnsignedShort(in)); bytesRead += RcRiffFile.SIZE_OF_UNSIGNED_SHORT; int extraDataSize = RcRiffFile.readUnsignedShort(in); bytesRead += RcRiffFile.SIZE_OF_UNSIGNED_SHORT;
String headerChunkId = RcRiffFile.readAscii(this.in, 4); if (!headerChunkId.equals(RcRiffBwf.RC_RIFF_HEADER_CHUNK_ID)) { chunkId = RcRiffFile.readAscii(this.in, 4); riffBytesRead += RcRiffChunk.SIZE_OF_CHUNK_ID; chunkSize = RcRiffFile.readUnsignedInt(this.in); riffBytesRead += RcRiffChunk.SIZE_OF_CHUNK_SIZE;
RcRiffFile.read64BitUnsignedInt( in)); this.setVersion(RcRiffFile.readUnsignedShort(in)); bytesRead += RcRiffFile.SIZE_OF_UNSIGNED_SHORT;
@Override public long write(RandomAccessFile out) throws IOException, RcBwfException { long bytesWritten = super.write(out); boolean valid = false; if (this.getListType().equals(RcRiffListChunk.RC_RIFF_INFO_LIST_TYPE)) { valid = true; } if (!valid) { throw new IOException(this.getListType() + " is not a valid LIST chunk type."); } bytesWritten += RcRiffFile.writeAscii(out, this.getListType()); return bytesWritten; }
@Override public long read(RandomAccessFile in, long ptr, long chunkSize) throws IOException { this.setPtr(ptr); this.setChunkSize(chunkSize); long bytesRead = 0L; // Read RIFF format this.setFormat(RcRiffFile.readAscii(in, RcRiffHeaderChunk.FORMAT_LENGTH)); bytesRead += RcRiffHeaderChunk.FORMAT_LENGTH; //System.out.println("\tFormat: " + this.getFormat()); return bytesRead; }
@Override public long read(RandomAccessFile in, long ptr, long chunkSize) throws IOException { this.setPtr(ptr); this.setChunkSize(chunkSize); this.setAXml(RcRiffFile.readUtf8(in, this.getChunkSize())); return this.getChunkSize(); }
@Override public long write(RandomAccessFile out) throws IOException, RcBwfException { String exPrefix = "Unable to write RIFF header chunk - "; if (this.getFormat() == null) { throw new IOException( exPrefix + "format is null."); } if (this.getFormat().trim().length() != RcRiffHeaderChunk.FORMAT_LENGTH) { throw new IOException( exPrefix + "format length must be " + RcRiffHeaderChunk.FORMAT_LENGTH + " characters."); } // Write chunk id and chunk size long chunkHeaderSize = super.write(out); // Write format Long chunkDataSize = 0L; chunkDataSize += RcRiffFile.writeAscii(out, this.getFormat().trim()); return chunkHeaderSize + chunkDataSize; }