public static int readFully(InputStream reader, byte[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
public static int readFully(Reader reader, char[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
@Override public void readBytes(byte[] b, int offset, int len) throws IOException { if (len < 0) throw new IndexOutOfBoundsException(); final int read = Streams.readFully(is, b, offset, len); if (read != len) { throw new EOFException(); } }
/** * Computes a strong hash value for small files. Note that this method should only be used for files < 1MB */ public static void hashFile(BytesRefBuilder fileHash, InputStream in, long size) throws IOException { final int len = (int) Math.min(1024 * 1024, size); // for safety we limit this to 1MB fileHash.grow(len); fileHash.setLength(len); final int readBytes = Streams.readFully(in, fileHash.bytes(), 0, len); assert readBytes == len : Integer.toString(readBytes) + " != " + Integer.toString(len); assert fileHash.length() == len : Integer.toString(fileHash.length()) + " != " + Integer.toString(len); }
public static int readFully(Reader reader, char[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
public static int readFully(Reader reader, char[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
public static int readFully(Reader reader, char[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
public static int readFully(Reader reader, char[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
public static int readFully(InputStream reader, byte[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
public static int readFully(InputStream reader, byte[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
public static int readFully(InputStream reader, byte[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
public static int readFully(InputStream reader, byte[] dest) throws IOException { return readFully(reader, dest, 0, dest.length); }
@Override public void readBytes(byte[] b, int offset, int len) throws IOException { if (len < 0) throw new IndexOutOfBoundsException(); final int read = Streams.readFully(is, b, offset, len); if (read != len) { throw new EOFException(); } }
@Override public void readBytes(byte[] b, int offset, int len) throws IOException { if (len < 0) throw new IndexOutOfBoundsException(); final int read = Streams.readFully(is, b, offset, len); if (read != len) { throw new EOFException(); } }
@Override public void readBytes(byte[] b, int offset, int len) throws IOException { if (len < 0) throw new IndexOutOfBoundsException(); final int read = Streams.readFully(is, b, offset, len); if (read != len) { throw new EOFException(); } }
@Override public void readBytes(byte[] b, int offset, int len) throws IOException { if (len < 0) throw new IndexOutOfBoundsException(); final int read = Streams.readFully(is, b, offset, len); if (read != len) { throw new EOFException(); } }
/** * Computes a strong hash value for small files. Note that this method should only be used for files < 1MB */ public static void hashFile(BytesRefBuilder fileHash, InputStream in, long size) throws IOException { final int len = (int) Math.min(1024 * 1024, size); // for safety we limit this to 1MB fileHash.grow(len); fileHash.setLength(len); final int readBytes = Streams.readFully(in, fileHash.bytes(), 0, len); assert readBytes == len : Integer.toString(readBytes) + " != " + Integer.toString(len); assert fileHash.length() == len : Integer.toString(fileHash.length()) + " != " + Integer.toString(len); }
/** * Computes a strong hash value for small files. Note that this method should only be used for files < 1MB */ public static void hashFile(BytesRefBuilder fileHash, InputStream in, long size) throws IOException { final int len = (int) Math.min(1024 * 1024, size); // for safety we limit this to 1MB fileHash.grow(len); fileHash.setLength(len); final int readBytes = Streams.readFully(in, fileHash.bytes(), 0, len); assert readBytes == len : Integer.toString(readBytes) + " != " + Integer.toString(len); assert fileHash.length() == len : Integer.toString(fileHash.length()) + " != " + Integer.toString(len); }
/** * Computes a strong hash value for small files. Note that this method should only be used for files < 1MB */ public static void hashFile(BytesRefBuilder fileHash, InputStream in, long size) throws IOException { final int len = (int) Math.min(1024 * 1024, size); // for safety we limit this to 1MB fileHash.grow(len); fileHash.setLength(len); final int readBytes = Streams.readFully(in, fileHash.bytes(), 0, len); assert readBytes == len : Integer.toString(readBytes) + " != " + Integer.toString(len); assert fileHash.length() == len : Integer.toString(fileHash.length()) + " != " + Integer.toString(len); }
/** * Computes a strong hash value for small files. Note that this method should only be used for files < 1MB */ public static void hashFile(BytesRefBuilder fileHash, InputStream in, long size) throws IOException { final int len = (int) Math.min(1024 * 1024, size); // for safety we limit this to 1MB fileHash.grow(len); fileHash.setLength(len); final int readBytes = Streams.readFully(in, fileHash.bytes(), 0, len); assert readBytes == len : Integer.toString(readBytes) + " != " + Integer.toString(len); assert fileHash.length() == len : Integer.toString(fileHash.length()) + " != " + Integer.toString(len); }