static Input inputFor(byte[] fileData) { InputStream in = new ByteArrayInputStream(fileData); if (fileData.length >= 4 && Arrays.equals(flippedHdsm, Arrays.copyOfRange(fileData, 0, 4))) { return new FlippedInputImpl(in); } else { return new InputImpl(in); } }
public void process(File inFile, OutputStream outStr) throws IOException, ItlException { /* Read the original library in */ Hdfm hdfm; InputStream inStr = new FileInputStream(inFile); try { Input di = new InputImpl(inStr); hdfm = Hdfm.read(di, inFile.length()); } finally { inStr.close(); } /* Modify... */ ByteArrayOutputStream dto = new ByteArrayOutputStream(); process(new DataInputStream(new ByteArrayInputStream(hdfm.fileData)), hdfm.fileData.length, new DataOutputStream(dto)); /* ...and write out */ DataOutput out = new DataOutputStream(outStr); hdfm.write(out, dto.toByteArray()); }
going = !ParseLibrary.readHdsm(new InputImpl(new ByteArrayInputStream(ba)), ba.length);
Input di = new InputImpl(in); while (remaining > 0) { int bl = di.readInt();
public static Library parse(InputStream in, long fileLength) throws IOException, ItlException { Input di = new InputImpl(in); Hdfm hdr = Hdfm.read(di, fileLength); ParseLibrary pl = new ParseLibrary(); String path = pl.drain(inputFor(hdr.fileData), hdr.fileData.length); // for (InputRange ir : pl.diagnostics) { // System.out.println(ir); // } Library library = new Library(hdr, path, pl.playlists, pl.podcasts, pl.tracks, pl.resourcesWithArtwork); return library; }
new InputImpl(new ByteArrayInputStream(pcInf)), pcInf.length)); } catch (IOException ioe) {