public void readFully(byte[] bytes) throws IOException { readFully(bytes, 0, bytes.length); }
private void readMagic(InputBuffer in) throws IOException { byte[] magic = new byte[ColumnFileWriter.MAGIC.length]; try { in.readFully(magic); } catch (IOException e) { throw new IOException("Not a data file."); } if (!(Arrays.equals(ColumnFileWriter.MAGIC, magic) || !Arrays.equals(ColumnFileWriter.MAGIC_1, magic) || !Arrays.equals(ColumnFileWriter.MAGIC_0, magic))) throw new IOException("Not a data file."); }
public byte[] readBytes() throws IOException { byte[] result = new byte[readInt()]; readFully(result); return result; }
public String readString() throws IOException { int length = readInt(); if (length <= (limit - pos)) { // in buffer String result = utf8.decode(ByteBuffer.wrap(buf, pos, length)).toString(); pos += length; return result; } byte[] bytes = new byte[length]; readFully(bytes, 0, length); return utf8.decode(ByteBuffer.wrap(bytes, 0, length)).toString(); }
public ByteBuffer readBytes(ByteBuffer old) throws IOException { int length = readInt(); ByteBuffer result; if (old != null && length <= old.capacity()) { result = old; result.clear(); } else { result = ByteBuffer.allocate(length); } readFully(result.array(), result.position(), length); result.limit(length); return result; }
private void startBlock(int block) throws IOException { this.block = block; this.row = column.firstRows[block]; in.seek(column.blockStarts[block]); int end = column.blocks[block].compressedSize; byte[] raw = new byte[end+checksum.size()]; in.readFully(raw); ByteBuffer data = codec.decompress(ByteBuffer.wrap(raw, 0, end)); if (!checksum.compute(data).equals (ByteBuffer.wrap(raw, end, checksum.size()))) throw new IOException("Checksums mismatch."); values = new InputBuffer(new InputBytes(data)); }
public void readFully(byte[] bytes) throws IOException { readFully(bytes, 0, bytes.length); }
private void readMagic(InputBuffer in) throws IOException { byte[] magic = new byte[ColumnFileWriter.MAGIC.length]; try { in.readFully(magic); } catch (IOException e) { throw new IOException("Not a data file."); } if (!(Arrays.equals(ColumnFileWriter.MAGIC, magic) || !Arrays.equals(ColumnFileWriter.MAGIC_0, magic))) throw new IOException("Not a data file."); }
public byte[] readBytes() throws IOException { byte[] result = new byte[readInt()]; readFully(result); return result; }
public String readString() throws IOException { int length = readInt(); if (length <= (limit - pos)) { // in buffer String result = new String(buf, pos, length, UTF8); // read directly pos += length; return result; } byte[] bytes = new byte[length]; readFully(bytes, 0, length); return new String(bytes, 0, length, UTF8); }
public ByteBuffer readBytes(ByteBuffer old) throws IOException { int length = readInt(); ByteBuffer result; if (old != null && length <= old.capacity()) { result = old; result.clear(); } else { result = ByteBuffer.allocate(length); } readFully(result.array(), result.position(), length); result.limit(length); return result; }
private void startBlock(int block) throws IOException { this.block = block; this.row = column.firstRows[block]; in.seek(column.blockStarts[block]); int end = column.blocks[block].compressedSize; byte[] raw = new byte[end+checksum.size()]; in.readFully(raw); ByteBuffer data = codec.decompress(ByteBuffer.wrap(raw, 0, end)); if (!checksum.compute(data).equals (ByteBuffer.wrap(raw, end, checksum.size()))) throw new IOException("Checksums mismatch."); values = new InputBuffer(new InputBytes(data)); }