public long getPosition() throws java.io.IOException { return file.getPosition(); }
public long getPosition() throws java.io.IOException { return file.getPosition(); }
int getPosition() { try { return (int)buf.getPosition(); } catch (java.io.IOException e) { throw new IOException(IOException.IoException, e); } } int nextIndexOffset;
int getPosition() { try { return (int)buf.getPosition(); } catch (java.io.IOException e) { throw new IOException(IOException.IoException, e); } } int nextIndexOffset;
/** * {@inheritDoc} */ public String readLine() throws java.io.IOException { StringBuilder input = new StringBuilder(); int c = -1; boolean eol = false; while (!eol) { switch (c = read()) { case -1: case '\n': eol = true; break; case '\r': eol = true; long cur = getPosition(); if ((read()) != '\n') { seek(cur); } break; default: input.append((char) c); break; } } if ((c == -1) && (input.length() == 0)) { return null; } return input.toString(); }
/** * {@inheritDoc} */ public String readLine() throws java.io.IOException { StringBuilder input = new StringBuilder(); int c = -1; boolean eol = false; while (!eol) { switch (c = read()) { case -1: case '\n': eol = true; break; case '\r': eol = true; long cur = getPosition(); if ((read()) != '\n') { seek(cur); } break; default: input.append((char) c); break; } } if ((c == -1) && (input.length() == 0)) { return null; } return input.toString(); }
long newpos; pos = getPosition(); len = length(); newpos = pos + n;
public void read() throws java.io.IOException { if (this.read) { throw new IllegalStateException("already.attempted.a.read.on.this.jbig2.file"); } this.read = true; readFileHeader(); // Annex D if (this.sequential) { // D.1 do { Jbig2Segment tmp = readHeader(); readSegment(tmp); segments.put(tmp.segmentNumber, tmp); } while (this.ra.getPosition() < this.ra.length()); } else { // D.2 Jbig2Segment tmp; do { tmp = readHeader(); segments.put(tmp.segmentNumber, tmp); } while (tmp.type != END_OF_FILE); for (int integer : segments.keySet()) { readSegment(segments.get(integer)); } } }
long newpos; pos = getPosition(); len = length(); newpos = pos + n;
public void read() throws java.io.IOException { if (this.read) { throw new IllegalStateException("already.attempted.a.read.on.this.jbig2.file"); } this.read = true; readFileHeader(); // Annex D if (this.sequential) { // D.1 do { Jbig2Segment tmp = readHeader(); readSegment(tmp); segments.put(tmp.segmentNumber, tmp); } while (this.ra.getPosition() < this.ra.length()); } else { // D.2 Jbig2Segment tmp; do { tmp = readHeader(); segments.put(tmp.segmentNumber, tmp); } while (tmp.type != END_OF_FILE); for (int integer : segments.keySet()) { readSegment(segments.get(integer)); } } }
void readSegment(Jbig2Segment s) throws java.io.IOException { int ptr = (int) ra.getPosition(); if (s.dataLength == 0xffffffffl) { // TODO figure this bit out, 7.2.7 return; } byte[] data = new byte[(int) s.dataLength]; ra.read(data); s.data = data; if (s.type == PAGE_INFORMATION) { int last = (int) ra.getPosition(); ra.seek(ptr); int page_bitmap_width = ra.readInt(); int page_bitmap_height = ra.readInt(); ra.seek(last); Jbig2Page p = pages.get(s.page); if (p == null) { throw new com.itextpdf.io.IOException("Referring to widht or height of a page we haven't seen yet: {0}").setMessageParams(s.page); } p.pageBitmapWidth = page_bitmap_width; p.pageBitmapHeight = page_bitmap_height; } }
void readSegment(Jbig2Segment s) throws java.io.IOException { int ptr = (int) ra.getPosition(); if (s.dataLength == 0xffffffffl) { // TODO figure this bit out, 7.2.7 return; } byte[] data = new byte[(int) s.dataLength]; ra.read(data); s.data = data; if (s.type == PAGE_INFORMATION) { int last = (int) ra.getPosition(); ra.seek(ptr); int page_bitmap_width = ra.readInt(); int page_bitmap_height = ra.readInt(); ra.seek(last); Jbig2Page p = pages.get(s.page); if (p == null) { throw new com.itextpdf.io.IOException("Referring to widht or height of a page we haven't seen yet: {0}").setMessageParams(s.page); } p.pageBitmapWidth = page_bitmap_width; p.pageBitmapHeight = page_bitmap_height; } }
/** * Helper method to handle content errors. Add file position to {@code PdfRuntimeException}. * @param error message. * @param messageParams error params. * @throws IOException wrap error message into {@code PdfRuntimeException} and add position in file. */ public void throwError(String error, Object... messageParams) { try { throw new IOException(IOException.ErrorAtFilePointer1, new IOException(error).setMessageParams(messageParams)) .setMessageParams(file.getPosition()); } catch (java.io.IOException e) { throw new IOException(IOException.ErrorAtFilePointer1, new IOException(error).setMessageParams(messageParams)) .setMessageParams(error, "no position"); } }
/** * Helper method to handle content errors. Add file position to {@code PdfRuntimeException}. * @param error message. * @param messageParams error params. * @throws IOException wrap error message into {@code PdfRuntimeException} and add position in file. */ public void throwError(String error, Object... messageParams) { try { throw new IOException(IOException.ErrorAtFilePointer1, new IOException(error).setMessageParams(messageParams)) .setMessageParams(file.getPosition()); } catch (java.io.IOException e) { throw new IOException(IOException.ErrorAtFilePointer1, new IOException(error).setMessageParams(messageParams)) .setMessageParams(error, "no position"); } }
throws java.io.IOException { long global_save_offset = stream.getPosition(); stream.seek(0L); int endian = stream.readUnsignedShort();
throws java.io.IOException { long global_save_offset = stream.getPosition(); stream.seek(0L); int endian = stream.readUnsignedShort();
long pointer = stream.getPosition(); // Save stream pointer
long pointer = stream.getPosition(); // Save stream pointer
throws java.io.IOException { long global_save_offset = stream.getPosition(); long ifd_offset;
throws java.io.IOException { long global_save_offset = stream.getPosition(); long ifd_offset;