private void skipSync() throws IOException { vin.readFixed(syncBuffer); if (!Arrays.equals(syncBuffer, sync)) throw new IOException("Invalid sync!"); }
private void skipSync() throws IOException { vin.readFixed(syncBuffer); if (!Arrays.equals(syncBuffer, sync)) throw new IOException("Invalid sync!"); }
DataBlock nextRawBlock(DataBlock reuse) throws IOException { if (!hasNextBlock()) { throw new NoSuchElementException(); } if (reuse == null || reuse.data.length < (int) blockSize) { reuse = new DataBlock(blockRemaining, (int) blockSize); } else { reuse.numEntries = blockRemaining; reuse.blockSize = (int)blockSize; } // throws if it can't read the size requested vin.readFixed(reuse.data, 0, reuse.blockSize); vin.readFixed(syncBuffer); availableBlock = false; if (!Arrays.equals(syncBuffer, header.sync)) throw new IOException("Invalid sync!"); return reuse; }
DataBlock nextRawBlock(DataBlock reuse) throws IOException { if (!hasNextBlock()) { throw new NoSuchElementException(); } if (reuse == null || reuse.data.length < (int) blockSize) { reuse = new DataBlock(blockRemaining, (int) blockSize); } else { reuse.numEntries = blockRemaining; reuse.blockSize = (int)blockSize; } // throws if it can't read the size requested vin.readFixed(reuse.data, 0, reuse.blockSize); vin.readFixed(syncBuffer); availableBlock = false; if (!Arrays.equals(syncBuffer, header.sync)) throw new IOException("Invalid sync!"); return reuse; }
int i=0, b; InputStream in = vin.inputStream(); vin.readFixed(syncBuffer); do { int j = 0;
int i=0, b; InputStream in = vin.inputStream(); vin.readFixed(syncBuffer); do { int j = 0;
/** 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 JsonToken decodeFixed(int size) throws IOException { byte[] data = new byte[size]; _decoder.readFixed(data); _binaryValue = data; return JsonToken.VALUE_EMBEDDED_OBJECT; }
@Override public void readFixed(byte[] bytes, int start, int length) throws IOException { wrappedDecoder.readFixed(bytes, start, length); }
@Override public void readFixed(byte[] bytes, int start, int length) throws IOException { wrappedDecoder.readFixed(bytes, start, length); }
@Override public void readFixed(byte[] bytes, int start, int length) throws IOException { wrappedDecoder.readFixed(bytes, start, length); }
void skipSync() throws IOException { vin.readFixed(syncBuffer); if (!Arrays.equals(syncBuffer, sync)) throw new IOException("Invalid sync!"); }
private void skipSync() throws IOException { vin.readFixed(syncBuffer); if (!Arrays.equals(syncBuffer, sync)) throw new IOException("Invalid sync!"); }
private void skipSync() throws IOException { vin.readFixed(syncBuffer); if (!Arrays.equals(syncBuffer, sync)) throw new IOException("Invalid sync!"); }
@Override public JsonToken readValue(AvroParserImpl parser, BinaryDecoder decoder) throws IOException { byte[] data = new byte[_size]; decoder.readFixed(data); return parser.setBytes(data); } }
@Override public PersistentBase deserialize(PersistentBase persistent) throws IOException { persistent = datumReader.read(reuseObjects ? persistent : null, decoder); byte[] __g__dirty = new byte[persistent.getFieldsCount()]; decoder.readFixed(__g__dirty); persistent.setDirtyBytes(java.nio.ByteBuffer.wrap(__g__dirty)); return persistent; } }
@Override public PersistentBase deserialize(PersistentBase persistent) throws IOException { persistent = datumReader.read(reuseObjects ? persistent : null, decoder); byte[] __g__dirty = new byte[persistent.getFieldsCount()]; decoder.readFixed(__g__dirty); persistent.setDirtyBytes(java.nio.ByteBuffer.wrap(__g__dirty)); return persistent; } }