org.apache.hadoop.io.file.tfile.Chunk.ChunkEncoder Java Examples
The following examples show how to use
org.apache.hadoop.io.file.tfile.Chunk.ChunkEncoder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TFile.java From hadoop with Apache License 2.0 | 6 votes |
/** * Obtain an output stream for writing a value into TFile. This may only be * called right after a key appending operation (the key append stream must * be closed). * * @param length * The expected length of the value. If length of the value is not * known, set length = -1. Otherwise, the application must write * exactly as many bytes as specified here before calling close on * the returned output stream. Advertising the value size up-front * guarantees that the value is encoded in one chunk, and avoids * intermediate chunk buffering. * @throws IOException * */ public DataOutputStream prepareAppendValue(int length) throws IOException { if (state != State.END_KEY) { throw new IllegalStateException( "Incorrect state to start a new value: " + state.name()); } DataOutputStream ret; // unknown length if (length < 0) { if (valueBuffer == null) { valueBuffer = new byte[getChunkBufferSize(conf)]; } ret = new ValueRegister(new ChunkEncoder(blkAppender, valueBuffer)); } else { ret = new ValueRegister(new Chunk.SingleChunkEncoder(blkAppender, length)); } state = State.IN_VALUE; return ret; }
Example #2
Source File: TFile.java From big-c with Apache License 2.0 | 6 votes |
/** * Obtain an output stream for writing a value into TFile. This may only be * called right after a key appending operation (the key append stream must * be closed). * * @param length * The expected length of the value. If length of the value is not * known, set length = -1. Otherwise, the application must write * exactly as many bytes as specified here before calling close on * the returned output stream. Advertising the value size up-front * guarantees that the value is encoded in one chunk, and avoids * intermediate chunk buffering. * @throws IOException * */ public DataOutputStream prepareAppendValue(int length) throws IOException { if (state != State.END_KEY) { throw new IllegalStateException( "Incorrect state to start a new value: " + state.name()); } DataOutputStream ret; // unknown length if (length < 0) { if (valueBuffer == null) { valueBuffer = new byte[getChunkBufferSize(conf)]; } ret = new ValueRegister(new ChunkEncoder(blkAppender, valueBuffer)); } else { ret = new ValueRegister(new Chunk.SingleChunkEncoder(blkAppender, length)); } state = State.IN_VALUE; return ret; }
Example #3
Source File: DTFile.java From attic-apex-malhar with Apache License 2.0 | 6 votes |
/** * Obtain an output stream for writing a value into TFile. This may only be * called right after a key appending operation (the key append stream must * be closed). * * @param length * The expected length of the value. If length of the value is not * known, set length = -1. Otherwise, the application must write * exactly as many bytes as specified here before calling close on * the returned output stream. Advertising the value size up-front * guarantees that the value is encoded in one chunk, and avoids * intermediate chunk buffering. * @throws IOException * */ public DataOutputStream prepareAppendValue(int length) throws IOException { if (state != State.END_KEY) { throw new IllegalStateException( "Incorrect state to start a new value: " + state.name()); } DataOutputStream ret; // unknown length if (length < 0) { if (valueBuffer == null) { valueBuffer = new byte[getChunkBufferSize(conf)]; } ret = new ValueRegister(new ChunkEncoder(blkAppender, valueBuffer)); } else { ret = new ValueRegister(new Chunk.SingleChunkEncoder(blkAppender, length)); } state = State.IN_VALUE; return ret; }
Example #4
Source File: TFile.java From RDFS with Apache License 2.0 | 6 votes |
/** * Obtain an output stream for writing a value into TFile. This may only be * called right after a key appending operation (the key append stream must * be closed). * * @param length * The expected length of the value. If length of the value is not * known, set length = -1. Otherwise, the application must write * exactly as many bytes as specified here before calling close on * the returned output stream. Advertising the value size up-front * guarantees that the value is encoded in one chunk, and avoids * intermediate chunk buffering. * @throws IOException * */ public DataOutputStream prepareAppendValue(int length) throws IOException { if (state != State.END_KEY) { throw new IllegalStateException( "Incorrect state to start a new value: " + state.name()); } DataOutputStream ret; // unknown length if (length < 0) { if (valueBuffer == null) { valueBuffer = new byte[getChunkBufferSize(conf)]; } ret = new ValueRegister(new ChunkEncoder(blkAppender, valueBuffer)); } else { ret = new ValueRegister(new Chunk.SingleChunkEncoder(blkAppender, length)); } state = State.IN_VALUE; return ret; }
Example #5
Source File: TFile.java From hadoop-gpu with Apache License 2.0 | 6 votes |
/** * Obtain an output stream for writing a value into TFile. This may only be * called right after a key appending operation (the key append stream must * be closed). * * @param length * The expected length of the value. If length of the value is not * known, set length = -1. Otherwise, the application must write * exactly as many bytes as specified here before calling close on * the returned output stream. Advertising the value size up-front * guarantees that the value is encoded in one chunk, and avoids * intermediate chunk buffering. * @throws IOException * */ public DataOutputStream prepareAppendValue(int length) throws IOException { if (state != State.END_KEY) { throw new IllegalStateException( "Incorrect state to start a new value: " + state.name()); } DataOutputStream ret; // unknown length if (length < 0) { if (valueBuffer == null) { valueBuffer = new byte[getChunkBufferSize(conf)]; } ret = new ValueRegister(new ChunkEncoder(blkAppender, valueBuffer)); } else { ret = new ValueRegister(new Chunk.SingleChunkEncoder(blkAppender, length)); } state = State.IN_VALUE; return ret; }