@Override public void open(long offset) throws ProxyCacheException { arrayInputStream = new ByteArrayInputStream(data); arrayInputStream.skip(offset); }
@Override public long skip(long n) { n = Math.min(length - pos, n); if (n == 0) { return 0; } if (buffer != null) { long s = buffer.skip(n); if (s > 0) { n = s; } else { buffer = null; skip += n; } } else { skip += n; } pos += n; return n; }
@Override public long skip(long n) { n = Math.min(length - pos, n); if (n == 0) { return 0; } if (buffer != null) { long s = buffer.skip(n); if (s > 0) { n = s; } else { buffer = null; skip += n; } } else { skip += n; } pos += n; return n; }
@Override public long skip(long n) { return mStream.skip(n); }
@Override public synchronized long skip(long arg0) { return getByteArrayInputStream().skip(arg0); }
/** * Returns a byte[] containing all the bytes from a ByteArrayInputStream. * Where possible, this returns the actual array rather than a copy. */ private static byte[] exposeByteArrayInputStreamBytes(ByteArrayInputStream bais) { byte[] buffer; synchronized (bais) { byte[] buf; int pos; try { buf = (byte[]) BAIS_BUF.get(bais); pos = BAIS_POS.getInt(bais); } catch (IllegalAccessException iae) { throw new AssertionError(iae); } int available = bais.available(); if (pos == 0 && buf.length == available) { buffer = buf; } else { buffer = new byte[available]; System.arraycopy(buf, pos, buffer, 0, available); } bais.skip(available); } return buffer; }
@Override public short readShort() { final int size = LittleEndianConsts.SHORT_SIZE; checkPosition(size); short le = LittleEndian.getShort(buf, pos); long skipped = super.skip(size); assert skipped == size : "Buffer overrun"; return le; }
@Override public int readInt() { final int size = LittleEndianConsts.INT_SIZE; checkPosition(size); int le = LittleEndian.getInt(buf, pos); long skipped = super.skip(size); assert skipped == size : "Buffer overrun"; return le; }
@Override public long readLong() { final int size = LittleEndianConsts.LONG_SIZE; checkPosition(size); long le = LittleEndian.getLong(buf, pos); long skipped = super.skip(size); assert skipped == size : "Buffer overrun"; return le; }
@Override public void fromBytes(byte[] row) { ByteArrayInputStream baos = new ByteArrayInputStream(row); baos.skip(KeyUtil.HASH_PREFIX_SIZE); DataInputStream w = new DataInputStream(baos); try { type = w.readUTF(); indicator = w.readUTF(); } catch (IOException e) { throw new RuntimeException("Unable to convert type and indicator from bytes", e); } }
public static Key fromBytes(byte[] buffer) throws IOException { ByteArrayInputStream baos = new ByteArrayInputStream(buffer); DataInputStream w = new DataInputStream(baos); baos.skip(KeyUtil.HASH_PREFIX_SIZE); return new Key(w.readUTF(), w.readUTF()); }
/** skip a little at a time, or sometimes zero */ @Override public long skip(long n) { return super.skip(Math.min(n, r.nextInt(4))); } }
byteArrayInputStream.skip(start);
public PacketJEIRecipe( final ByteBuf stream ) throws IOException { final ByteArrayInputStream bytes = this.getPacketByteArray( stream ); bytes.skip( stream.readerIndex() ); final NBTTagCompound comp = CompressedStreamTools.readCompressed( bytes ); if( comp != null ) { this.recipe = new ItemStack[9][]; for( int x = 0; x < this.recipe.length; x++ ) { final NBTTagList list = comp.getTagList( "#" + x, 10 ); if( list.tagCount() > 0 ) { this.recipe[x] = new ItemStack[list.tagCount()]; for( int y = 0; y < list.tagCount(); y++ ) { this.recipe[x][y] = new ItemStack( list.getCompoundTagAt( y ) ); } } } } }
public long skip(long n) throws IOException { //testNextBytes(); return byteStreamInput.skip(n); }
totalBytes = 0; inputStream.skip(totalBytes); logger.log(Level.INFO, "totalBytes " + totalBytes); } else {
public void seek(ByteArrayInputStream input, int position) throws IOException { input.reset(); input.skip(position); }
public synchronized SeekableByteChannel position(long newPosition) throws IOException { if ( newPosition < 0 ) { throw new IllegalArgumentException("negative new position: " + newPosition); } if ( newPosition > Integer.MAX_VALUE ) { throw new IllegalArgumentException("can not set new position: " + newPosition + " too big!"); } this.in.reset(); // to initial mark (0 or offset) if ( newPosition > 0 ) this.in.skip(newPosition); //this.position = (int) newPosition; return this; }
@Override public int readInt() { final int size = LittleEndianConsts.INT_SIZE; checkPosition(size); int le = LittleEndian.getInt(buf, pos); long skipped = super.skip(size); assert skipped == size : "Buffer overrun"; return le; }
@Override public Channel getRemainingAsChannel() { ByteArrayInputStream bais = new ByteArrayInputStream(completeSource.unsafeBytes(), completeSource.begin(), completeSource.realSize()); bais.skip(offset); return ChannelHelper.readableChannel(bais); }