/** * Reads an unsigned byte from a DataInputStream. * @param stream Stream to read */ public static int readUnsignedByte (DataInputStream stream) throws IOException { return readUnsignedByte (stream, null); }
private static String read4Chars (DataInputStream stream) throws IOException { StringBuffer sbuf = new StringBuffer(4); for (int i = 0; i < 4; i++) { int ch = ModuleBase.readUnsignedByte(stream, null); sbuf.append((char) ch); } return sbuf.toString (); } }
private String read4Chars() throws IOException { StringBuffer sbuf = new StringBuffer(4); for (int i = 0; i < 4; i++) { int ch = ModuleBase.readUnsignedByte(dstream, null); sbuf.append((char) ch); } return sbuf.toString(); }
int zplm = ModuleBase.readUnsignedByte (_dstream, _module); --bytesToEat; if (zplm == 0) { nplmLeft = ModuleBase.readUnsignedByte (_dstream, _module); --bytesToEat; long pktLen = 0; for (;;) { int pkByte = ModuleBase.readUnsignedByte (_dstream, _module); if (--bytesToEat < 0) {
int unshiftedNote = ModuleBase.readUnsignedByte (_dstream, _module); int fineTune = ModuleBase.readSignedByte (_dstream, _module); int gain = ModuleBase.readSignedByte (_dstream, _module); int lowNote = ModuleBase.readUnsignedByte (_dstream, _module); int highNote = ModuleBase.readUnsignedByte (_dstream, _module); int lowVelocity = ModuleBase.readUnsignedByte (_dstream, _module); int highVelocity = ModuleBase.readUnsignedByte (_dstream, _module);
/** Reads an unsigned number of any type. * @param type TIFF type to read */ public long readUnsigned(int type) throws IOException { long u = 0L; switch (type) { case BYTE: case UNDEFINED: u = ModuleBase.readUnsignedByte(_raf); break; case SHORT: u = ModuleBase.readUnsignedShort(_raf, _bigEndian); break; case LONG: case IFD: u = ModuleBase.readUnsignedInt(_raf, _bigEndian); break; } return u; }
int baseNote = ModuleBase.readUnsignedByte (_dstream, module); int detune = ModuleBase.readSignedByte (_dstream, module); int lowNote = ModuleBase.readUnsignedByte (_dstream, module); int highNote = ModuleBase.readUnsignedByte (_dstream, module); int lowVelocity = ModuleBase.readUnsignedByte (_dstream, module); int highVelocity = ModuleBase.readUnsignedByte (_dstream, module); int gain = module.readSignedShort (_dstream); Loop sustainLoop = readLoop (module);
/** * Reads the header of a chunk. If _chunkID is non-null, * it's assumed to have already been read. */ public boolean readHeader (DataInputStream dstrm) throws IOException { StringBuffer id = new StringBuffer(4); for (int i = 0; i < 4; i++) { int ch = ModuleBase.readUnsignedByte (dstrm, _module); if (ch < 32) { String hx = Integer.toHexString (ch); if (hx.length () < 2) { hx = "0" + hx; } _repInfo.setMessage (new ErrorMessage (MessageConstants.ERR_CHUNK_ID_CHAR_INV, MessageConstants.ERR_CHUNK_ID_CHAR_SUB + hx, _module.getNByte ())); _repInfo.setWellFormed (false); return false; } id.append((char) ch); } _chunkID = id.toString (); _size = ModuleBase.readUnsignedInt (dstrm, _module.isBigEndian (), _module); return true; }
int v = ModuleBase.readUnsignedByte (_dstrm, _module); if (v != 0) { _repInfo.setMessage (new ErrorMessage int b = ModuleBase.readUnsignedByte(_dstrm, _module); if (b == 0) { break;
compIdx = ModuleBase.readUnsignedByte (_dstream, _module); int srgn = ModuleBase.readUnsignedByte (_dstream, _module); int sprgn = ModuleBase.readUnsignedByte (_dstream, _module); MainOrTile cs = getMainOrTile ();
csProp[1] = new Property ("HorizontalResolution", PropertyType.INTEGER, new Integer (ModuleBase.readUnsignedByte (_dstrm, _module))); csProp[2] = new Property ("VerticalResolution", PropertyType.INTEGER, new Integer (ModuleBase.readUnsignedByte (_dstrm, _module))); csProp[3] = new Property ("HorizontalOffset", PropertyType.INTEGER, new Integer (ModuleBase.readUnsignedByte (_dstrm, _module))); csProp[4] = new Property ("VerticalOffset", PropertyType.INTEGER, new Integer (ModuleBase.readUnsignedByte (_dstrm, _module)));
return false; // a tile (SOT) is required int zplt = ModuleBase.readUnsignedByte (_dstream, _module); --bytesToEat; long pktLen = 0; for (;;) { int pkByte = ModuleBase.readUnsignedByte (_dstream, _module); if (--bytesToEat < 0) {
int height = _module.readUnsignedShort (dstream); int width = _module.readUnsignedShort (dstream); int tns = ModuleBase.readUnsignedByte (dstream, _module); int tnbps = ModuleBase.readUnsignedByte (dstream, _module); int tnc = ModuleBase.readUnsignedByte (dstream, _module); _module.skipBytes (dstream, length - 13, _module);
int otyp = ModuleBase.readUnsignedByte (_dstrm, _module); propList.add (_module.addIntegerProperty ("Type", otyp, int nch = ModuleBase.readUnsignedByte (_dstrm, _module); for (int j = 0; j < keysize; j++) { chkey = (chkey << 8) + ModuleBase.readUnsignedByte (_dstrm, _module);
/** Process the marker segment. The DataInputStream * will be at the point of having read the marker code. The * <code>process</code> method must consume exactly the number * of bytes remaining in the marker segment. * * @param bytesToEat The number of bytes that must be consumed. * If it is 0 for a MarkerSegment, the * number of bytes to consume is unknown. */ protected boolean process (int bytesToEat) throws IOException { int tileIndex = _module.readUnsignedShort (_dstream); long tileLeft = _module.readUnsignedInt (_dstream); _ccs.setTileLeft (tileLeft); int tilePartIndex = ModuleBase.readUnsignedByte (_dstream, _module); int numTileParts = ModuleBase.readUnsignedByte (_dstream, _module); Tile tile = _ccs.getTile (tileIndex); _ccs.setCurTile (tile); TilePart tp = new TilePart (tile, tilePartIndex); tile.addTilePart (tp); tp.setLength (tileLeft); // Shouldn't be anything left, but... if (bytesToEat > 8) { _module.skipBytes (_dstream, bytesToEat - 8, _module); } 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[] bytes = new byte[len]; for (int i = 0; i < len; i++) { bytes[i] = (byte) ModuleBase.readUnsignedByte (_dstrm, _module); } _module.addProperty (new Property ("IntellectualPropertyRights", PropertyType.BYTE, PropertyArity.ARRAY, bytes)); finalizeBytesRead (); return true; }
int zppm = ModuleBase.readUnsignedByte (_dstream, _module); --bytesToEat;
int vrcExp = ModuleBase.readUnsignedByte (_dstrm, _module); int hrcExp = ModuleBase.readUnsignedByte (_dstrm, _module);
/** 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 JP2HeaderBox || _parentBox instanceof CodestreamHeaderBox)) { wrongBoxContext(); return false; } initBytesRead (); int len = (int) _boxHeader.getDataLength (); int[] bits = new int[len]; for (int i = 0; i < len; i++) { bits[i] = ModuleBase.readUnsignedByte (_dstrm, _module); } NisoImageMetadata niso; niso = _module.getCurrentNiso (); niso.setBitsPerSample (bits); finalizeBytesRead (); return true; }
int zppt = ModuleBase.readUnsignedByte (_dstream, _module); --bytesToEat; while (bytesToEat > 0) {