@Override public long read(RandomAccessFile in, long ptr, long chunkSize) throws IOException { this.setPtr(ptr); this.setChunkSize(chunkSize); byte md5Bytes[] = new byte[(int) this.getChunkSize()]; in.readFully(md5Bytes); // Little endian this.setStoredMd5(this.reverse(md5Bytes)); // Big endian //System.out.println("\tStored MD5: " + RcRiffMd5Chunk.bigEndianByteArrayToHexString(this.getStoredMd5())); return this.getChunkSize(); }
@Override public long write(RandomAccessFile out) throws IOException, RcBwfException { if (this.getStoredMd5() == null || this.getStoredMd5().length == 0) { return 0L; } this.setChunkSize(this.getStoredMd5().length); long bytesWritten = super.write(out); out.write(this.reverse(this.getStoredMd5())); bytesWritten += this.getStoredMd5().length; return bytesWritten; }
public RcRiffMd5Chunk() { super(); this.setChunkId(RcRiffBwf.RC_RIFF_MD5_CHUNK_ID); }
public void storeMd5() throws IOException { if (this.getRcRiffMd5Chunk() == null) { this.setRcRiffMd5Chunk(new RcRiffMd5Chunk()); } this.getRcRiffDataChunk().calculateMd5Checksum(); this.getRcRiffMd5Chunk().setStoredMd5( this.getRcRiffDataChunk().getCalculatedMd5()); } }
byte md5Bytes[] = rcRiffMd5Chunk.getStoredMd5(); String md5Hex = RcRiffMd5Chunk.bigEndianByteArrayToHexString(md5Bytes); String md5Hex = RcRiffMd5Chunk.bigEndianByteArrayToHexString(md5Bytes);
RcRiffMd5Chunk rcRiffMd5Chunk = new RcRiffMd5Chunk(); riffBytesRead += rcRiffMd5Chunk.read(this.in, ptr, chunkSize);
String md5Hex = RcRiffMd5Chunk.bigEndianByteArrayToHexString(md5Bytes); String md5DateTime = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()).toXMLFormat();