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; }
@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 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; }
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; }
chunkDataSize += RcRiffFile.writeAscii( out, this.getDescription().trim()); chunkDataSize += RcRiffFile.writeAscii( out, this.getOriginator().trim()); chunkDataSize += RcRiffFile.writeAscii( out, this.getOriginatorReference().trim()); chunkDataSize += RcRiffFile.writeAscii( out, this.getOriginationDate().trim()); chunkDataSize += RcRiffFile.writeAscii( out, this.getOriginationTime().trim()); chunkDataSize += RcRiffFile.writeAscii( out, this.getCodingHistory().trim());