/** * Answer a short comprised of the next * two bytes of the input stream. */ public short readShort() throws IOException { byte[] buf = new byte[2]; read(buf); return (short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF)); }
/** * Skip over signature data. This has already been * verified in isFileFormat(). */ void readSignature() throws IOException { byte[] signature = new byte[SIGNATURE_LENGTH]; inputStream.read(signature); } /**
/** * Skip over signature data. This has already been * verified in isFileFormat(). */ void readSignature() throws IOException { byte[] signature = new byte[SIGNATURE_LENGTH]; inputStream.read(signature); } /**
/** * Skip over signature data. This has already been * verified in isFileFormat(). */ void readSignature() throws IOException { byte[] signature = new byte[SIGNATURE_LENGTH]; inputStream.read(signature); } /**
/** * Answer an integer comprised of the next * four bytes of the input stream. */ public int readInt() throws IOException { byte[] buf = new byte[4]; read(buf); return ((buf[3] & 0xFF) << 24) | ((buf[2] & 0xFF) << 16) | ((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF); }
/** * Answer a short comprised of the next * two bytes of the input stream. */ public short readShort() throws IOException { byte[] buf = new byte[2]; read(buf); return (short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF)); }
/** * Read and return the next block or extension identifier from the file. */ int readID() { try { return inputStream.read(); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } return -1; }
static boolean isFileFormat(LEDataInputStream stream) { try { byte[] buffer = new byte[2]; stream.read(buffer); stream.unread(buffer); return (buffer[0] & 0xFF) == 0xFF && (buffer[1] & 0xFF) == M_SOI; } catch (Exception e) { return false; } }
boolean isFileFormat(LEDataInputStream stream) { try { byte[] header = new byte[18]; stream.read(header); stream.unread(header); int infoHeaderSize = (header[14] & 0xFF) | ((header[15] & 0xFF) << 8) | ((header[16] & 0xFF) << 16) | ((header[17] & 0xFF) << 24); return header[0] == 0x42 && header[1] == 0x4D && infoHeaderSize >= BMPHeaderFixedSize; } catch (Exception e) { return false; } } boolean isPaletteBMP(PaletteData pal, int depth) {
/** * Read and return the next block or extension identifier from the file. */ int readID() { try { return inputStream.read(); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } return -1; }
@Override boolean isFileFormat(LEDataInputStream stream) { try { byte[] signature = new byte[3]; stream.read(signature); stream.unread(signature); return signature[0] == 'G' && signature[1] == 'I' && signature[2] == 'F'; } catch (Exception e) { return false; } }
static boolean isFileFormat(LEDataInputStream stream) { try { byte[] buffer = new byte[2]; stream.read(buffer); stream.unread(buffer); return (buffer[0] & 0xFF) == 0xFF && (buffer[1] & 0xFF) == M_SOI; } catch (Exception e) { return false; } }
static boolean isFileFormat(LEDataInputStream stream) { try { byte[] buffer = new byte[2]; stream.read(buffer); stream.unread(buffer); return (buffer[0] & 0xFF) == 0xFF && (buffer[1] & 0xFF) == M_SOI; } catch (Exception e) { return false; } }
@Override boolean isFileFormat(LEDataInputStream stream) { try { byte[] header = new byte[4]; stream.read(header); stream.unread(header); return header[0] == 0 && header[1] == 0 && header[2] == 1 && header[3] == 0; } catch (Exception e) { return false; } } boolean isValidIcon(ImageData i) {
boolean isFileFormat(LEDataInputStream stream) { try { byte[] header = new byte[4]; stream.read(header); stream.unread(header); return header[0] == 0 && header[1] == 0 && header[2] == 1 && header[3] == 0; } catch (Exception e) { return false; } } boolean isValidIcon(ImageData i) {
@Override boolean isFileFormat(LEDataInputStream stream) { try { byte[] signature = new byte[3]; stream.read(signature); stream.unread(signature); return signature[0] == 'G' && signature[1] == 'I' && signature[2] == 'F'; } catch (Exception e) { return false; } }
/** * Read and return the next block or extension identifier from the file. */ int readID() { try { return inputStream.read(); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } return -1; }
byte[] loadData(byte[] infoHeader, int stride) { int dataSize = height * stride; byte[] data = new byte[dataSize]; try { if (inputStream.read(data) != dataSize) SWT.error(SWT.ERROR_INVALID_IMAGE); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } return data; } int[] loadFileHeader() {
public JPEGFixedSizeSegment(LEDataInputStream byteStream) { reference = new byte[fixedSize()]; try { byteStream.read(reference); } catch (Exception e) { SWT.error(SWT.ERROR_IO, e); } }
public JPEGFixedSizeSegment(LEDataInputStream byteStream) { reference = new byte[fixedSize()]; try { byteStream.read(reference); } catch (Exception e) { SWT.error(SWT.ERROR_IO, e); } }