/** * Reads the chunk's text data. * All text chunk subclasses consist of a text string * which takes up the full byte count of the chunk. * By the specification, the text is required to be ASCII. */ protected String readText () throws IOException { byte[] buf = new byte[(int) bytesLeft]; ModuleBase.readByteBuf (_dstream, buf, _module); /* Ensure that each byt is a printable ASCII character. */ for (int i=0; i<buf.length; i++) { if (buf[i] < 32 || buf[i] > 127) { buf[i] = 32; } } return new String (buf, "ASCII"); } }
/** Reads a chunk and puts a BroadcastAudioExtension Property into * the RepInfo object. * * @return <code>false</code> if the chunk is structurally * invalid, otherwise <code>true</code> */ public boolean readChunk(RepInfo info) throws IOException { WaveModule module = (WaveModule) _module; byte[] bbuf = new byte[(int) bytesLeft]; ModuleBase.readByteBuf (_dstream, bbuf, _module); String xmlData = new String (bbuf); module.addWaveProperty (new Property ("XML", PropertyType.STRING, xmlData)); return true; } }
/** Reads the box, saving the label text. * setModule, setBoxHeader, * setRepInfo and setDataInputStream must be called * before <code>readBox</code> is called. * <code>readBox</code> must completely consume the * box, so that the next byte to be read by the * DataInputStream is the <code>FF</code> byte of the next Box. */ public boolean readBox() throws IOException { if (_parentBox == null) { wrongBoxContext(); return false; } byte[] byteBuf = new byte [(int) _boxHeader.getDataLength()]; ModuleBase.readByteBuf (_dstrm, byteBuf, _module); _label = new String (byteBuf, "UTF-8"); return true; }
/** Reads the text item, and returns a Property containing the * cue point ID and the text. */ protected Property readTextProp (WaveModule module, String propName) throws IOException { long cueID = module.readUnsignedInt (_dstream); bytesLeft -= 4; byte[] buf = new byte[(int) bytesLeft]; ModuleBase.readByteBuf (_dstream, buf, module); String txt = new String (buf).trim (); Property[] propArr = new Property[2]; propArr[0] = new Property ("CuePointID", PropertyType.LONG, new Long (cueID)); propArr[1] = new Property ("Text", PropertyType.STRING, txt); return new Property (propName, PropertyType.PROPERTY, PropertyArity.ARRAY, propArr); }
/** Reads a chunk and puts an MIDI property into * the RepInfo object. * * @return <code>false</code> if the chunk is structurally * invalid, otherwise <code>true</code> */ public boolean readChunk(RepInfo info) throws IOException { AiffModule module = (AiffModule) _module; if (bytesLeft == 0) { return true; // dubious, but call it legal } byte[] buf = new byte[(int) bytesLeft]; ModuleBase.readByteBuf (_dstream, buf, _module); module.addMidi (new Property ("MIDI", PropertyType.BYTE, PropertyArity.ARRAY, buf)); return true; }
/** Reads a chunk and puts information into the superchunk's * Exif property. * * @return <code>false</code> if the chunk is structurally * invalid, otherwise <code>true</code> */ public boolean readChunk(RepInfo info) throws IOException { WaveModule module = (WaveModule) _module; byte[] buf = new byte[(int) bytesLeft]; ModuleBase.readByteBuf (_dstream, buf, module); ExifInfo exif = module.getExifInfo (); module.getExifInfo ().setMakerNote (buf); return true; }
ModuleBase.readByteBuf (_dstream, buf, module); String encoding = new String (buf).trim (); bytesLeft -= 8; ModuleBase.readByteBuf (_dstream, buf, module); String text = null; try {
/** Reads a chunk and puts information into the superchunk's * Exif property. * * @return <code>false</code> if the chunk is structurally * invalid, otherwise <code>true</code> */ public boolean readChunk(RepInfo info) throws IOException { WaveModule module = (WaveModule) _module; byte[] buf = new byte[(int) bytesLeft]; ModuleBase.readByteBuf (_dstream, buf, module); String txt = new String (buf).trim (); ExifInfo exif = module.getExifInfo (); if ("erel".equals (id)) { exif.setRelatedImageFile(txt); } else if ("etim".equals (id)) { exif.setTimeCreated (txt); } else if ("ecor".equals (id)) { exif.setManufacturer(txt); } else if ("emdl".equals (id)) { exif.setModel (txt); } module.getExifInfo ().setRelatedImageFile(txt); return true; }
/** Reads the box, putting appropriate information in * the RepInfo object. setModule, setBoxHeader, * setRepInfo and setDataInputStream must be called * before <code>readBox</code> is called. * <code>readBox</code> must completely consume the * box, so that the next byte to be read by the * DataInputStream is the <code>FF</code> byte of the next Box. */ public boolean readBox() throws IOException { initBytesRead (); int len = (int) _boxHeader.getDataLength (); byte[] bbuf = new byte[len]; ModuleBase.readByteBuf (_dstrm, bbuf, _module); xmlData = new String (bbuf); if (_parentBox == null) { _module.addXML (xmlData); } finalizeBytesRead (); return true; }
int codePage = module.readUnsignedShort (_dstream); byte[] buf = new byte[(int) (bytesLeft - 20)]; ModuleBase.readByteBuf(_dstream, buf, module); String text = new String (buf).trim ();
/** Reads a chunk and puts information into the superchunk's * Exif property. * * @return <code>false</code> if the chunk is structurally * invalid, otherwise <code>true</code> */ public boolean readChunk(RepInfo info) throws IOException { WaveModule module = (WaveModule) _module; if (bytesLeft != 4) { info.setMessage (new ErrorMessage (MessageConstants.ERR_EXIF_VER_CHUNK_LEN_WRNG)); info.setWellFormed (false); return false; } byte[] buf = new byte[4]; ModuleBase.readByteBuf (_dstream, buf, module); String txt = new String (buf); module.getExifInfo ().setExifVersion(txt); return true; }
ModuleBase.readByteBuf (_dstream, buf, module); ByteArrayInputStream bais = new ByteArrayInputStream (buf); ByteArrayXMPSource xs = new ByteArrayXMPSource (bais);
Property prop; byte[] byteBuf = new byte[bytesToEat - 2]; ModuleBase.readByteBuf (_dstream, byteBuf, _module); switch (rcom) { case 0:
ModuleBase.readByteBuf (_dstrm, uuidbuf, _module); boolean isGzip = true; for (int i = 0; i < 16; i++) {
bytesLeft -= 8; byte[] buf = new byte[count]; ModuleBase.readByteBuf(_dstream, buf, module); bytesLeft -= count;
String applicationSignature = module.read4Chars (_dstream); byte[] data = new byte[(int) (bytesLeft - 4)]; ModuleBase.readByteBuf (_dstream, data, _module); Property[] propArr = new Property[2]; propArr[0] = new Property ("ApplicationSignature",
ModuleBase.readByteBuf(_dstrm, data, _module);
/** Reads a chunk and puts an AudioRecording property into * the RepInfo object. * * @return <code>false</code> if the chunk is structurally * invalid, otherwise <code>true</code> */ public boolean readChunk(RepInfo info) throws IOException { AiffModule module = (AiffModule) _module; if (bytesLeft != 24) { // This chunk must always have exactly 24 bytes data info.setMessage (new ErrorMessage (MessageConstants.ERR_REC_CHUNK_WRONG_SIZE, module.getNByte ())); info.setWellFormed (false); return false; } byte[] buf = new byte[24]; ModuleBase.readByteBuf (_dstream, buf, module); module.addAiffProperty (new Property ("AudioRecording", PropertyType.BYTE, PropertyArity.ARRAY, buf)); return true; }
ModuleBase.readByteBuf (_dstrm, uuid, _module); parray[0] = new Property ("UUID", PropertyType.BYTE, if (dataLen > 0) { byte[] dataBytes = new byte[dataLen]; ModuleBase.readByteBuf (_dstrm, dataBytes, _module); parray[1] = new Property ("Data", PropertyType.BYTE,
/** Reads the box, putting appropriate information in * the RepInfo object. setModule, setBoxHeader, * setRepInfo and setDataInputStream must be called * before <code>readBox</code> is called. * <code>readBox</code> must completely consume the * box, so that the next byte to be read by the * DataInputStream is the <code>FF</code> byte of the next Box. */ public boolean readBox() throws IOException { if (!(_parentBox instanceof UUIDInfoBox)) { wrongBoxContext(); return false; } initBytesRead (); int nUUID = _module.readUnsignedShort (_dstrm); if ((16 * nUUID + 2) != _boxHeader.getDataLength()) { wrongBoxSize (); return false; } byte[][] uuids = new byte[nUUID][]; for (int i = 0; i < nUUID; i++) { ModuleBase.readByteBuf (_dstrm, uuids[i], _module); } if (_parentBox instanceof UUIDInfoBox) { ((UUIDInfoBox) _parentBox).setUUIDList (uuids); } finalizeBytesRead (); return true; }