/** * Creates new instance of range input stream. * * @param in * source stream * @param offset * offset of the range * @param limit * length of the range * @throws IOException * on I/O exception during seeking to the specified offset */ public RangeInputStream(InputStream in, long offset, long limit) throws IOException { super(in); this.limit = limit; IOUtils.skipFully(in, offset); }
/** * Creates new instance of range reader. * * @param r * source reader * @param offset * offset of the range * @param limit * length of the range * @throws IOException * on I/O exception during seeking to the specified offset */ public RangeReader(Reader r, long offset, long limit) throws IOException { this.r = r; this.limit = limit; IOUtils.skipFully(r, offset); }
if (!skipUsingRead) { try { IOUtils.skipFully(in, skip); } catch (NullPointerException e) {
/** * Returns some bytes of the object. * * @param pos the index, the first byte is at position 1 * @param length the number of bytes * @return the bytes, at most length bytes */ @Override public byte[] getBytes(long pos, int length) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBytes("+pos+", "+length+");"); } checkClosed(); ByteArrayOutputStream out = new ByteArrayOutputStream(); try (InputStream in = value.getInputStream()) { IOUtils.skipFully(in, pos - 1); IOUtils.copy(in, out, length); } return out.toByteArray(); } catch (Exception e) { throw logAndConvert(e); } }
Math.min(Constants.IO_BUFFER_SIZE, length)); try (Reader reader = value.getReader()) { IOUtils.skipFully(reader, pos - 1); IOUtils.copyAndCloseInput(reader, writer, length);
IOUtils.skipFully(in, start - 1); int pos = 0; int patternPos = 0;
if (!skipUsingRead) { try { IOUtils.skipFully(in, skip); } catch (NullPointerException e) {
if (!skipUsingRead) { try { IOUtils.skipFully(in, skip); } catch (NullPointerException e) {
public void readFully(byte[] b, int off, int len) throws IOException { if (inPos > pos) { if (in != null) { in.close(); } in = null; } if (in == null) { in = file.getInputStream(entry); inPos = 0; } if (inPos < pos) { IOUtils.skipFully(in, pos - inPos); inPos = pos; } int l = IOUtils.readFully(in, b, off, len); if (l != len) { throw new EOFException(); } pos += len; inPos += len; }
public synchronized void send(FileSystem fs, String fileName, long skip) throws IOException { connect(); try { OutputStream out = socket.getOutputStream(); InputStream in = fs.openFileInputStream(fileName); IOUtils.skipFully(in, skip); IOUtils.copy(in, out); in.close(); } finally { socket.close(); } server.trace("closed"); }
InputStream in = value.getInputStream(); try { IOUtils.skipFully(in, pos - 1); while (length > 0) { int x = in.read();
Reader reader = value.getReader(); try { IOUtils.skipFully(reader, pos - 1); for (int i = 0; i < length; i++) { int ch = reader.read();
/** * Returns some bytes of the object. * * @param pos the index, the first byte is at position 1 * @param length the number of bytes * @return the bytes, at most length bytes */ @Override public byte[] getBytes(long pos, int length) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBytes("+pos+", "+length+");"); } checkClosed(); ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream in = value.getInputStream(); try { IOUtils.skipFully(in, pos - 1); IOUtils.copy(in, out, length); } finally { in.close(); } return out.toByteArray(); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns some bytes of the object. * * @param pos the index, the first byte is at position 1 * @param length the number of bytes * @return the bytes, at most length bytes */ @Override public byte[] getBytes(long pos, int length) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBytes("+pos+", "+length+");"); } checkClosed(); ByteArrayOutputStream out = new ByteArrayOutputStream(); try (InputStream in = value.getInputStream()) { IOUtils.skipFully(in, pos - 1); IOUtils.copy(in, out, length); } return out.toByteArray(); } catch (Exception e) { throw logAndConvert(e); } }
Reader reader = value.getReader(); try { IOUtils.skipFully(reader, pos - 1); IOUtils.copyAndCloseInput(reader, writer, length); } finally {
Math.min(Constants.IO_BUFFER_SIZE, length)); try (Reader reader = value.getReader()) { IOUtils.skipFully(reader, pos - 1); IOUtils.copyAndCloseInput(reader, writer, length);
IOUtils.skipFully(in, start - 1); int pos = 0; int patternPos = 0;
IOUtils.skipFully(in, start - 1); int pos = 0; int patternPos = 0;