return false; File file = new File(getFullName()); if (!file.exists() || file.length() == 0) return false; RandomAccessFile raFile = new RandomAccessFile(getFullName(), "r"); try { long byteCount = readHeader(raFile) - HEADER_OFFSET; throw new RuntimeException("Problem while loading " + getFullName(), ex);
@Override public void flush() { if (closed) throw new IllegalStateException("already closed"); if (!store) return; try { RandomAccessFile raFile = new RandomAccessFile(getFullName(), "rw"); try { long len = getCapacity(); writeHeader(raFile, len, segmentSizeInBytes); raFile.seek(HEADER_OFFSET); // raFile.writeInt() <- too slow, so copy into byte array for (int s = 0; s < segments.length; s++) { byte area[] = segments[s]; raFile.write(area); } } finally { raFile.close(); } } catch (Exception ex) { throw new RuntimeException("Couldn't store bytes to " + toString(), ex); } }
return false; File file = new File(getFullName()); if (!file.exists() || file.length() == 0) return false; RandomAccessFile raFile = new RandomAccessFile(getFullName(), "r"); try { long byteCount = readHeader(raFile) - HEADER_OFFSET; throw new RuntimeException("Problem while loading " + getFullName(), ex);
return false; File file = new File(getFullName()); if (!file.exists() || file.length() == 0) return false; RandomAccessFile raFile = new RandomAccessFile(getFullName(), "r"); try { long byteCount = readHeader(raFile) - HEADER_OFFSET; throw new RuntimeException("Problem while loading " + getFullName(), ex);
@Override public void flush() { if (closed) throw new IllegalStateException("already closed"); if (!store) return; try { RandomAccessFile raFile = new RandomAccessFile(getFullName(), "rw"); try { long len = getCapacity(); writeHeader(raFile, len, segmentSizeInBytes); raFile.seek(HEADER_OFFSET); // raFile.writeInt() <- too slow, so copy into byte array for (int s = 0; s < segments.length; s++) { byte area[] = segments[s]; raFile.write(area); } } finally { raFile.close(); } } catch (Exception ex) { throw new RuntimeException("Couldn't store bytes to " + toString(), ex); } }
return false; File file = new File(getFullName()); if (!file.exists() || file.length() == 0) return false; RandomAccessFile raFile = new RandomAccessFile(getFullName(), "r"); try throw new RuntimeException("Problem while loading " + getFullName(), ex);
@Override public void flush() { if (closed) throw new IllegalStateException("already closed"); if (!store) return; try { RandomAccessFile raFile = new RandomAccessFile(getFullName(), "rw"); try { long len = getCapacity(); writeHeader(raFile, len, segmentSizeInBytes); raFile.seek(HEADER_OFFSET); // raFile.writeInt() <- too slow, so copy into byte array for (int s = 0; s < segments.length; s++) { byte area[] = segments[s]; raFile.write(area); } } finally { raFile.close(); } } catch (Exception ex) { throw new RuntimeException("Couldn't store bytes to " + toString(), ex); } }
@Override public void flush() { if (closed) throw new IllegalStateException("already closed"); if (!store) return; try { RandomAccessFile raFile = new RandomAccessFile(getFullName(), "rw"); try { long len = getCapacity(); writeHeader(raFile, len, segmentSizeInBytes); raFile.seek(HEADER_OFFSET); // raFile.writeInt() <- too slow, so copy into byte array for (int s = 0; s < segments.length; s++) { byte area[] = segments[s]; raFile.write(area); } } finally { raFile.close(); } } catch (Exception ex) { throw new RuntimeException("Couldn't store bytes to " + toString(), ex); } }