void copyEntireChunkAsIs(PackOutputStream out, DhtObjectToPack obj, boolean validate) throws IOException { if (validate && !isValid()) { if (obj != null) throw new CorruptObjectException(obj, MessageFormat.format( DhtText.get().corruptChunk, getChunkKey())); else throw new DhtException(MessageFormat.format( DhtText.get().corruptChunk, getChunkKey())); } // Do not copy the trailer onto the output stream. out.write(dataBuf, dataPtr, dataLen - TRAILER_SIZE); }
@SuppressWarnings("unchecked") public void writeObjects(PackOutputStream out, List<ObjectToPack> objects) throws IOException { prefetcher = prefetch(0, readerOptions.getWriteObjectsPrefetchRatio()); try { List itr = objects; new ObjectWriter(this, prefetcher).plan(itr); for (ObjectToPack otp : objects) out.writeObject(otp); } finally { endPrefetch(); } }
throw new DhtException(MessageFormat.format( DhtText.get().expectedObjectSizeDuringCopyAsIs, obj)); out.writeHeader(obj, inflatedSize); out.write(dataBuf, ptr, copyLen);
long position = out.length(); ChunkMeta meta = chunk.getMeta(); if (meta != null && meta.getBaseChunkCount() != 0) {
throw new DhtException(MessageFormat.format( DhtText.get().expectedObjectSizeDuringCopyAsIs, obj)); out.writeHeader(obj, inflatedSize); out.write(dataBuf, ptr, copyLen);
long position = out.length(); ChunkMeta meta = chunk.getMeta(); if (meta != null && meta.getBaseChunkCount() != 0) {
@SuppressWarnings("unchecked") public void writeObjects(PackOutputStream out, List<ObjectToPack> objects) throws IOException { prefetcher = prefetch(0, readerOptions.getWriteObjectsPrefetchRatio()); try { List itr = objects; new ObjectWriter(this, prefetcher).plan(itr); for (ObjectToPack otp : objects) out.writeObject(otp); } finally { endPrefetch(); } }
void copyEntireChunkAsIs(PackOutputStream out, DhtObjectToPack obj, boolean validate) throws IOException { if (validate && !isValid()) { if (obj != null) throw new CorruptObjectException(obj, MessageFormat.format( DhtText.get().corruptChunk, getChunkKey())); else throw new DhtException(MessageFormat.format( DhtText.get().corruptChunk, getChunkKey())); } // Do not copy the trailer onto the output stream. out.write(dataBuf, dataPtr, dataLen - TRAILER_SIZE); }