private void readImageHeader(int opcode) throws IOException { if (opcode == PICT_9A) in.skipBytes(6); else rowBytes &= 0x3fff; int tlY = in.readShort(); int tlX = in.readShort(); int brY = in.readShort(); int brX = in.readShort(); if (brX - tlX > 0) core.get(0).sizeX = brX - tlX; if (brY - tlY > 0) core.get(0).sizeY = brY - tlY; in.skipBytes(18); }
private void readImageHeader(int opcode) throws IOException { if (opcode == PICT_9A) in.skipBytes(6); else rowBytes &= 0x3fff; int tlY = in.readShort(); int tlX = in.readShort(); int brY = in.readShort(); int brX = in.readShort(); if (brX - tlX > 0) core.get(0).sizeX = brX - tlX; if (brY - tlY > 0) core.get(0).sizeY = brY - tlY; in.skipBytes(18); }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 2; if (!FormatTools.validStream(stream, blockLen, false)) return false; return stream.readShort() == KHOROS_MAGIC_BYTES; }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 2; if (!FormatTools.validStream(stream, blockLen, false)) return false; return (stream.readShort() & 0xffff) == MAGIC_BYTES; }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 2; if (!FormatTools.validStream(stream, blockLen, false)) return false; return stream.readShort() == KHOROS_MAGIC_BYTES; }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 2; if (!FormatTools.validStream(stream, blockLen, false)) return false; return (stream.readShort() & 0xffff) == MAGIC_BYTES; }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 8; stream.seek(4); boolean littleEndian = stream.readString(2).equals("II"); if (!FormatTools.validStream(stream, blockLen, littleEndian)) return false; int magicBytes1 = stream.readShort(); int magicBytes2 = stream.readShort(); return ((magicBytes2 & 0xff00) == SLD_MAGIC_BYTES_1_1 || (magicBytes2 & 0xff00) == SLD_MAGIC_BYTES_1_2) && (magicBytes1 == SLD_MAGIC_BYTES_1_0 || magicBytes1 == SLD_MAGIC_BYTES_2_0); }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 8; stream.seek(4); boolean littleEndian = stream.readString(2).equals("II"); if (!FormatTools.validStream(stream, blockLen, littleEndian)) return false; int magicBytes1 = stream.readShort(); int magicBytes2 = stream.readShort(); return ((magicBytes2 & 0xff00) == SLD_MAGIC_BYTES_1_1 || (magicBytes2 & 0xff00) == SLD_MAGIC_BYTES_1_2) && (magicBytes1 == SLD_MAGIC_BYTES_1_0 || magicBytes1 == SLD_MAGIC_BYTES_2_0); }
/** Skip an unknown tag. */ private int skipTagBlock() throws IOException { in.skipBytes(1); int length = in.readShort(); in.skipBytes(length); return length; }
/** Skip an unknown tag. */ private int skipTagBlock() throws IOException { in.skipBytes(1); int length = in.readShort(); in.skipBytes(length); return length; }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 56; if (!FormatTools.validStream(stream, blockLen, LITTLE_ENDIAN)) { return false; } String c = stream.readString(blockLen); stream.seek(54); return stream.readShort() == PIC_FILE_ID || c.startsWith("[Input Sources]"); }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 56; if (!FormatTools.validStream(stream, blockLen, LITTLE_ENDIAN)) { return false; } String c = stream.readString(blockLen); stream.seek(54); return stream.readShort() == PIC_FILE_ID || c.startsWith("[Input Sources]"); }
private int getFileVersion(RandomAccessInputStream stream) throws IOException { stream.seek(0); stream.order(LITTLE_ENDIAN); try { final String magicString = stream.readString(FILE_MAGIC_STRING.length()); final short magicNumber = stream.readShort(); final int version = stream.readInt(); if (magicString.equals(FILE_MAGIC_STRING) && magicNumber == MAGIC_NUMBER) { return version; } } catch(IOException exception) { } return - 1; }
private int getFileVersion(RandomAccessInputStream stream) throws IOException { stream.seek(0); stream.order(LITTLE_ENDIAN); try { final String magicString = stream.readString(FILE_MAGIC_STRING.length()); final short magicNumber = stream.readShort(); final int version = stream.readInt(); if (magicString.equals(FILE_MAGIC_STRING) && magicNumber == MAGIC_NUMBER) { return version; } } catch(IOException exception) { } return - 1; }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 8; if (!FormatTools.validStream(stream, blockLen, false)) return false; boolean validStart = (stream.readShort() & 0xffff) == 0xff4f; if (!validStart) { stream.skipBytes(2); validStart = stream.readInt() == JPEG2000BoxType.SIGNATURE.getCode(); } stream.seek(stream.length() - 2); boolean validEnd = (stream.readShort() & 0xffff) == 0xffd9; return validStart && validEnd; }
@Override public boolean isThisType(RandomAccessInputStream stream) throws IOException { final int blockLen = 8; if (!FormatTools.validStream(stream, blockLen, false)) return false; boolean validStart = (stream.readShort() & 0xffff) == 0xff4f; if (!validStart) { stream.skipBytes(2); validStart = stream.readInt() == JPEG2000BoxType.SIGNATURE.getCode(); } stream.seek(stream.length() - 2); boolean validEnd = (stream.readShort() & 0xffff) == 0xffd9; return validStart && validEnd; }
/** Read the header for an image stack. */ private void readStackHeader() throws IOException { int count = in.readInt(); if (count > 0xffff) { in.seek(in.getFilePointer() - 2); int len = in.readShort(); in.skipBytes(len); count = in.readInt() + 1; } skipTags(count); skipTagBlock(); }
/** Read the header for an image stack. */ private void readStackHeader() throws IOException { int count = in.readInt(); if (count > 0xffff) { in.seek(in.getFilePointer() - 2); int len = in.readShort(); in.skipBytes(len); count = in.readInt() + 1; } skipTags(count); skipTagBlock(); }