/** * Constructor. * * @param out * the underlying output stream. * @param size * The total # of bytes to be written as a single chunk. * @throws java.io.IOException * if an I/O error occurs. */ public SingleChunkEncoder(DataOutputStream out, int size) throws IOException { this.out = out; this.remain = size; Utils.writeVInt(out, size); }
/** * Write out a chunk. * * @param chunk * The chunk buffer. * @param offset * Offset to chunk buffer for the beginning of chunk. * @param len * @param last * Is this the last call to flushBuffer? */ private void writeChunk(byte[] chunk, int offset, int len, boolean last) throws IOException { if (last) { // always write out the length for the last chunk. Utils.writeVInt(out, len); if (len > 0) { out.write(chunk, offset, len); } } else { if (len > 0) { Utils.writeVInt(out, -len); out.write(chunk, offset, len); } } }
/** * Write a String as a VInt n, followed by n Bytes as in Text format. * * @param out * @param s * @throws IOException */ public static void writeString(DataOutput out, String s) throws IOException { if (s != null) { Text text = new Text(s); byte[] buffer = text.getBytes(); int len = text.getLength(); writeVInt(out, len); out.write(buffer, 0, len); } else { writeVInt(out, -1); } }
/** * Write out a chunk that is a concatenation of the internal buffer plus * user supplied data. This will never be the last block. * * @param data * User supplied data buffer. * @param offset * Offset to user data buffer. * @param len * User data buffer size. */ private void writeBufData(byte[] data, int offset, int len) throws IOException { if (count + len > 0) { Utils.writeVInt(out, -(count + len)); out.write(buf, 0, count); count = 0; out.write(data, offset, len); } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, key.length); out.write(key, 0, key.length); Utils.writeVLong(out, kvEntries); } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, index.size()); for (MetaIndexEntry indexEntry : index.values()) { indexEntry.write(out); } } }
public void write(DataOutput out) throws IOException { Utils.writeString(out, defaultCompressionAlgorithm.getName()); Utils.writeVInt(out, listRegions.size()); for (BlockRegion region : listRegions) { region.write(out); } } }
public void write(DataOutput out) throws IOException { if (firstKey == null) { Utils.writeVInt(out, 0); return; } DataOutputBuffer dob = new DataOutputBuffer(); Utils.writeVInt(dob, firstKey.size()); dob.write(firstKey.buffer()); Utils.writeVInt(out, dob.size()); out.write(dob.getData(), 0, dob.getLength()); for (TFileIndexEntry entry : index) { dob.reset(); entry.write(dob); Utils.writeVInt(out, dob.getLength()); out.write(dob.getData(), 0, dob.getLength()); } } }
Utils.writeVInt(blkAppender, len); blkAppender.write(key, 0, len); if (tfileIndex.getFirstKey() == null) {
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, key.length); out.write(key, 0, key.length); Utils.writeVLong(out, kvEntries); } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, index.size()); for (MetaIndexEntry indexEntry : index.values()) { indexEntry.write(out); } } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, index.size()); for (MetaIndexEntry indexEntry : index.values()) { indexEntry.write(out); } } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, key.length); out.write(key, 0, key.length); Utils.writeVLong(out, kvEntries); } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, index.size()); for (MetaIndexEntry indexEntry : index.values()) { indexEntry.write(out); } } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, key.length); out.write(key, 0, key.length); Utils.writeVLong(out, kvEntries); } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, index.size()); for (MetaIndexEntry indexEntry : index.values()) { indexEntry.write(out); } } }
public void write(DataOutput out) throws IOException { Utils.writeVInt(out, index.size()); for (MetaIndexEntry indexEntry : index.values()) { indexEntry.write(out); } } }
public void write(DataOutput out) throws IOException { Utils.writeString(out, defaultCompressionAlgorithm.getName()); Utils.writeVInt(out, listRegions.size()); for (BlockRegion region : listRegions) { region.write(out); } } }
public void write(DataOutput out) throws IOException { Utils.writeString(out, defaultCompressionAlgorithm.getName()); Utils.writeVInt(out, listRegions.size()); for (BlockRegion region : listRegions) { region.write(out); } } }
public void write(DataOutput out) throws IOException { Utils.writeString(out, defaultCompressionAlgorithm.getName()); Utils.writeVInt(out, listRegions.size()); for (BlockRegion region : listRegions) { region.write(out); } } }