/** Move to the next synchronization point after a position. */ @Override public synchronized void sync(long position) throws IOException { if (in.tell()+SYNC_SIZE >= in.length()) { seek(in.length()); return; } in.seek(position); vin.readFixed(syncBuffer); for (int i = 0; in.tell() < in.length(); i++) { int j = 0; for (; j < sync.length; j++) { if (sync[j] != syncBuffer[(i+j)%sync.length]) break; } if (j == sync.length) { // position before sync seek(in.tell() - SYNC_SIZE); return; } syncBuffer[i%sync.length] = (byte)in.read(); } seek(in.length()); }
/** Move to the next synchronization point after a position. */ @Override public synchronized void sync(long position) throws IOException { if (in.tell()+SYNC_SIZE >= in.length()) { seek(in.length()); return; } in.seek(position); vin.readFixed(syncBuffer); for (int i = 0; in.tell() < in.length(); i++) { int j = 0; for (; j < sync.length; j++) { if (sync[j] != syncBuffer[(i+j)%sync.length]) break; } if (j == sync.length) { // position before sync seek(in.tell() - SYNC_SIZE); return; } syncBuffer[i%sync.length] = (byte)in.read(); } seek(in.length()); }
@Override public int read() throws IOException { int n = read(oneByte, 0, 1); if (n == 1) { return oneByte[0] & 0xff; } else { return n; } }
@Override public int read() throws IOException { int n = read(oneByte, 0, 1); if (n == 1) { return oneByte[0] & 0xff; } else { return n; } };
@Override public int read() throws IOException { int n = read(oneByte, 0, 1); if (n == 1) { return oneByte[0] & 0xff; } else { return n; } };
@Override public int read() throws IOException { int n = read(oneByte, 0, 1); if (n == 1) { return oneByte[0] & 0xff; } else { return n; } }
/** Move to the next synchronization point after a position. */ @Override public synchronized void sync(long position) throws IOException { if (in.tell()+SYNC_SIZE >= in.length()) { seek(in.length()); return; } in.seek(position); vin.readFixed(syncBuffer); for (int i = 0; in.tell() < in.length(); i++) { int j = 0; for (; j < sync.length; j++) { if (sync[j] != syncBuffer[(i+j)%sync.length]) break; } if (j == sync.length) { // position before sync seek(in.tell() - SYNC_SIZE); return; } syncBuffer[i%sync.length] = (byte)in.read(); } seek(in.length()); }
/** Move to the next synchronization point after a position. */ @Override public synchronized void sync(long position) throws IOException { if (in.tell()+SYNC_SIZE >= in.length()) { seek(in.length()); return; } in.seek(position); vin.readFixed(syncBuffer); for (int i = 0; in.tell() < in.length(); i++) { int j = 0; for (; j < sync.length; j++) { if (sync[j] != syncBuffer[(i+j)%sync.length]) break; } if (j == sync.length) { // position before sync seek(in.tell() - SYNC_SIZE); return; } syncBuffer[i%sync.length] = (byte)in.read(); } seek(in.length()); }
@Override public int read() throws IOException { int n = read(oneByte, 0, 1); if (n == 1) { return oneByte[0] & 0xff; } else { return n; } }
@Override public int read() throws IOException { int n = read(oneByte, 0, 1); if (n == 1) { return oneByte[0] & 0xff; } else { return n; } }