@Override public void flush() { if (isClosed()) throw new IllegalStateException("already closed"); try { RandomAccessFile raFile = new RandomAccessFile(getFullName(), "rw"); try { long len = getCapacity(); writeHeader(raFile, len, segmentSizeInBytes); raFile.seek(HEADER_OFFSET); byte bytes[] = new byte[segmentSizeInBytes]; int segs = getSegments(); for (int s = 0; s < segs; s++) { getBytes(s * segmentSizeInBytes, bytes, segmentSizeInBytes); raFile.write(bytes); } } finally { raFile.close(); } } catch (Exception ex) { throw new RuntimeException("Couldn't store bytes to " + toString(), ex); } }
@Override public boolean loadExisting() { if (isClosed()) throw new IllegalStateException("already closed");
@Override public void flush() { if (isClosed()) throw new IllegalStateException("already closed"); try { RandomAccessFile raFile = new RandomAccessFile(getFullName(), "rw"); try { long len = getCapacity(); writeHeader(raFile, len, segmentSizeInBytes); raFile.seek(HEADER_OFFSET); byte bytes[] = new byte[segmentSizeInBytes]; int segs = getSegments(); for (int s = 0; s < segs; s++) { getBytes(s * segmentSizeInBytes, bytes, segmentSizeInBytes); raFile.write(bytes); } } finally { raFile.close(); } } catch (Exception ex) { throw new RuntimeException("Couldn't store bytes to " + toString(), ex); } }
@Override public void flush() { if (isClosed()) throw new IllegalStateException("already closed"); try { RandomAccessFile raFile = new RandomAccessFile(getFullName(), "rw"); try { long len = getCapacity(); writeHeader(raFile, len, segmentSizeInBytes); raFile.seek(HEADER_OFFSET); byte bytes[] = new byte[segmentSizeInBytes]; int segs = getSegments(); for (int s = 0; s < segs; s++) { getBytes(s * segmentSizeInBytes, bytes, segmentSizeInBytes); raFile.write(bytes); } } finally { raFile.close(); } } catch (Exception ex) { throw new RuntimeException("Couldn't store bytes to " + toString(), ex); } }
@Override public boolean loadExisting() { if (isClosed()) throw new IllegalStateException("already closed");
@Override public boolean loadExisting() { if (isClosed()) throw new IllegalStateException("already closed");
@Override public void flush() { if (isClosed()) throw new IllegalStateException("already closed"); try { RandomAccessFile raFile = new RandomAccessFile(getFullName(), "rw"); try { long len = getCapacity(); writeHeader(raFile, len, segmentSizeInBytes); raFile.seek(HEADER_OFFSET); byte bytes[] = new byte[segmentSizeInBytes]; int segs = getSegments(); for (int s = 0; s < segs; s++) { getBytes(s * segmentSizeInBytes, bytes, segmentSizeInBytes); raFile.write(bytes); } } finally { raFile.close(); } } catch (Exception ex) { throw new RuntimeException("Couldn't store bytes to " + toString(), ex); } }
@Override public boolean loadExisting() if (isClosed()) throw new IllegalStateException("already closed");