DataOutputStream dosKey = prepareAppendKey(klen); try { ++errorCount; DataOutputStream dosValue = prepareAppendValue(vlen); try { ++errorCount;
/** * Obtain an output stream for writing a key into TFile. This may only be * called when there is no active Key appending stream or value appending * stream. * * @param length * The expected length of the key. If length of the key 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. * @return The key appending output stream. * @throws IOException * */ public DataOutputStream prepareAppendKey(int length) throws IOException { if (state != State.READY) { throw new IllegalStateException("Incorrect state to start a new key: " + state.name()); } initDataBlock(); DataOutputStream ret = new KeyRegister(length); state = State.IN_KEY; return ret; }
/** * Obtain an output stream for creating a meta block. This function may not * be called when there is a key append stream or value append stream * active. No more key-value insertion is allowed after a meta data block * has been added to TFile. * * @param name * Name of the meta block. * @param compressName * Name of the compression algorithm to be used. Must be one of the * strings returned by * {@link TFile#getSupportedCompressionAlgorithms()}. * @return A DataOutputStream that can be used to write Meta Block data. * Closing the stream would signal the ending of the block. * @throws IOException * @throws MetaBlockAlreadyExists * the Meta Block with the same name already exists. */ public DataOutputStream prepareMetaBlock(String name, String compressName) throws IOException, MetaBlockAlreadyExists { if (state != State.READY) { throw new IllegalStateException( "Incorrect state to start a Meta Block: " + state.name()); } finishDataBlock(true); DataOutputStream outputStream = writerBCF.prepareMetaBlock(name, compressName); return outputStream; }
/** * Obtain an output stream for creating a meta block. This function may not * be called when there is a key append stream or value append stream * active. No more key-value insertion is allowed after a meta data block * has been added to TFile. * * @param name * Name of the meta block. * @param compressName * Name of the compression algorithm to be used. Must be one of the * strings returned by * {@link TFile#getSupportedCompressionAlgorithms()}. * @return A DataOutputStream that can be used to write Meta Block data. * Closing the stream would signal the ending of the block. * @throws IOException * @throws MetaBlockAlreadyExists * the Meta Block with the same name already exists. */ public DataOutputStream prepareMetaBlock(String name, String compressName) throws IOException, MetaBlockAlreadyExists { if (state != State.READY) { throw new IllegalStateException( "Incorrect state to start a Meta Block: " + state.name()); } finishDataBlock(true); DataOutputStream outputStream = writerBCF.prepareMetaBlock(name, compressName); return outputStream; }
/** * Obtain an output stream for creating a meta block. This function may not * be called when there is a key append stream or value append stream * active. No more key-value insertion is allowed after a meta data block * has been added to TFile. * * @param name * Name of the meta block. * @param compressName * Name of the compression algorithm to be used. Must be one of the * strings returned by * {@link TFile#getSupportedCompressionAlgorithms()}. * @return A DataOutputStream that can be used to write Meta Block data. * Closing the stream would signal the ending of the block. * @throws IOException * @throws MetaBlockAlreadyExists * the Meta Block with the same name already exists. */ public DataOutputStream prepareMetaBlock(String name, String compressName) throws IOException, MetaBlockAlreadyExists { if (state != State.READY) { throw new IllegalStateException( "Incorrect state to start a Meta Block: " + state.name()); } finishDataBlock(true); DataOutputStream outputStream = writerBCF.prepareMetaBlock(name, compressName); return outputStream; }
/** * Obtain an output stream for creating a meta block. This function may not * be called when there is a key append stream or value append stream * active. No more key-value insertion is allowed after a meta data block * has been added to TFile. Data will be compressed using the default * compressor as defined in Writer's constructor. * * @param name * Name of the meta block. * @return A DataOutputStream that can be used to write Meta Block data. * Closing the stream would signal the ending of the block. * @throws IOException * @throws MetaBlockAlreadyExists * the Meta Block with the same name already exists. */ public DataOutputStream prepareMetaBlock(String name) throws IOException, MetaBlockAlreadyExists { if (state != State.READY) { throw new IllegalStateException( "Incorrect state to start a Meta Block: " + state.name()); } finishDataBlock(true); return writerBCF.prepareMetaBlock(name); }
/** * Obtain an output stream for writing a key into TFile. This may only be * called when there is no active Key appending stream or value appending * stream. * * @param length * The expected length of the key. If length of the key 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. * @return The key appending output stream. * @throws IOException * */ public DataOutputStream prepareAppendKey(int length) throws IOException { if (state != State.READY) { throw new IllegalStateException("Incorrect state to start a new key: " + state.name()); } initDataBlock(); DataOutputStream ret = new KeyRegister(length); state = State.IN_KEY; return ret; }
/** * Obtain an output stream for writing a key into TFile. This may only be * called when there is no active Key appending stream or value appending * stream. * * @param length * The expected length of the key. If length of the key 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. * @return The key appending output stream. * @throws IOException * */ public DataOutputStream prepareAppendKey(int length) throws IOException { if (state != State.READY) { throw new IllegalStateException("Incorrect state to start a new key: " + state.name()); } initDataBlock(); DataOutputStream ret = new KeyRegister(length); state = State.IN_KEY; return ret; }
/** * Obtain an output stream for creating a meta block. This function may not * be called when there is a key append stream or value append stream * active. No more key-value insertion is allowed after a meta data block * has been added to TFile. Data will be compressed using the default * compressor as defined in Writer's constructor. * * @param name * Name of the meta block. * @return A DataOutputStream that can be used to write Meta Block data. * Closing the stream would signal the ending of the block. * @throws IOException * @throws MetaBlockAlreadyExists * the Meta Block with the same name already exists. */ public DataOutputStream prepareMetaBlock(String name) throws IOException, MetaBlockAlreadyExists { if (state != State.READY) { throw new IllegalStateException( "Incorrect state to start a Meta Block: " + state.name()); } finishDataBlock(true); return writerBCF.prepareMetaBlock(name); }
/** * Obtain an output stream for creating a meta block. This function may not * be called when there is a key append stream or value append stream * active. No more key-value insertion is allowed after a meta data block * has been added to TFile. Data will be compressed using the default * compressor as defined in Writer's constructor. * * @param name * Name of the meta block. * @return A DataOutputStream that can be used to write Meta Block data. * Closing the stream would signal the ending of the block. * @throws IOException * @throws MetaBlockAlreadyExists * the Meta Block with the same name already exists. */ public DataOutputStream prepareMetaBlock(String name) throws IOException, MetaBlockAlreadyExists { if (state != State.READY) { throw new IllegalStateException( "Incorrect state to start a Meta Block: " + state.name()); } finishDataBlock(true); return writerBCF.prepareMetaBlock(name); }
/** * Obtain an output stream for creating a meta block. This function may not * be called when there is a key append stream or value append stream * active. No more key-value insertion is allowed after a meta data block * has been added to TFile. Data will be compressed using the default * compressor as defined in Writer's constructor. * * @param name * Name of the meta block. * @return A DataOutputStream that can be used to write Meta Block data. * Closing the stream would signal the ending of the block. * @throws IOException * @throws MetaBlockAlreadyExists * the Meta Block with the same name already exists. */ public DataOutputStream prepareMetaBlock(String name) throws IOException, MetaBlockAlreadyExists { if (state != State.READY) { throw new IllegalStateException( "Incorrect state to start a Meta Block: " + state.name()); } finishDataBlock(true); return writerBCF.prepareMetaBlock(name); }
/** * Obtain an output stream for writing a key into TFile. This may only be * called when there is no active Key appending stream or value appending * stream. * * @param length * The expected length of the key. If length of the key 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. * @return The key appending output stream. * @throws IOException * */ public DataOutputStream prepareAppendKey(int length) throws IOException { if (state != State.READY) { throw new IllegalStateException("Incorrect state to start a new key: " + state.name()); } initDataBlock(); DataOutputStream ret = new KeyRegister(length); state = State.IN_KEY; return ret; }
/** * Obtain an output stream for writing a key into TFile. This may only be * called when there is no active Key appending stream or value appending * stream. * * @param length * The expected length of the key. If length of the key 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. * @return The key appending output stream. * @throws IOException * */ public DataOutputStream prepareAppendKey(int length) throws IOException { if (state != State.READY) { throw new IllegalStateException("Incorrect state to start a new key: " + state.name()); } initDataBlock(); DataOutputStream ret = new KeyRegister(length); state = State.IN_KEY; return ret; }
/** * Obtain an output stream for creating a meta block. This function may not * be called when there is a key append stream or value append stream * active. No more key-value insertion is allowed after a meta data block * has been added to TFile. Data will be compressed using the default * compressor as defined in Writer's constructor. * * @param name * Name of the meta block. * @return A DataOutputStream that can be used to write Meta Block data. * Closing the stream would signal the ending of the block. * @throws IOException * @throws MetaBlockAlreadyExists * the Meta Block with the same name already exists. */ public DataOutputStream prepareMetaBlock(String name) throws IOException, MetaBlockAlreadyExists { if (state != State.READY) { throw new IllegalStateException( "Incorrect state to start a Meta Block: " + state.name()); } finishDataBlock(true); return writerBCF.prepareMetaBlock(name); }
/** * Obtain an output stream for writing a key into TFile. This may only be * called when there is no active Key appending stream or value appending * stream. * * @param length * The expected length of the key. If length of the key 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. * @return The key appending output stream. * @throws IOException * */ public DataOutputStream prepareAppendKey(int length) throws IOException { if (state != State.READY) { throw new IllegalStateException("Incorrect state to start a new key: " + state.name()); } initDataBlock(); DataOutputStream ret = new KeyRegister(length); state = State.IN_KEY; return ret; }
@Override public void close() throws IOException { if (closed == true) { return; } try { ++errorCount; super.close(); blkRecordCount++; // bump up the total record count in the whole file tfileMeta.incRecordCount(); finishDataBlock(false); --errorCount; } finally { closed = true; state = State.READY; } } }
@Override public void close() throws IOException { if (closed == true) { return; } try { ++errorCount; super.close(); blkRecordCount++; // bump up the total record count in the whole file tfileMeta.incRecordCount(); finishDataBlock(false); --errorCount; } finally { closed = true; state = State.READY; } } }
@Override public void close() throws IOException { if (closed == true) { return; } try { ++errorCount; super.close(); blkRecordCount++; // bump up the total record count in the whole file tfileMeta.incRecordCount(); finishDataBlock(false); --errorCount; } finally { closed = true; state = State.READY; } } }
@Override public void close() throws IOException { if (closed == true) { return; } try { ++errorCount; super.close(); blkRecordCount++; // bump up the total record count in the whole file tfileMeta.incRecordCount(); finishDataBlock(false); --errorCount; } finally { closed = true; state = State.READY; } } }