/** * Write the given element to disk, and return the associated marker. * * @param element to write * @return marker representing the element * @throws java.io.IOException on write error */ protected DiskMarker write(Element element) throws IOException { MemoryEfficientByteArrayOutputStream buffer = serializeElement(element); int bufferLength = buffer.size(); elementSize = bufferLength; DiskMarker marker = alloc(element, bufferLength); // Write the record final RandomAccessFile data = getDataAccess(element.getObjectKey()); synchronized (data) { data.seek(marker.getPosition()); data.write(buffer.toByteArray(), 0, bufferLength); } return marker; }
/** * Write the given element to disk, and return the associated marker. * * @param element to write * @return marker representing the element * @throws java.io.IOException on write error */ protected DiskMarker write(Element element) throws IOException { MemoryEfficientByteArrayOutputStream buffer = serializeElement(element); int bufferLength = buffer.size(); elementSize = bufferLength; DiskMarker marker = alloc(element, bufferLength); // Write the record final RandomAccessFile data = getDataAccess(element.getObjectKey()); synchronized (data) { data.seek(marker.getPosition()); data.write(buffer.toByteArray(), 0, bufferLength); } return marker; }
/** * Write the given element to disk, and return the associated marker. * * @param element to write * @return marker representing the element * @throws java.io.IOException on write error */ protected DiskMarker write(Element element) throws IOException { MemoryEfficientByteArrayOutputStream buffer = serializeElement(element); int bufferLength = buffer.size(); elementSize = bufferLength; DiskMarker marker = alloc(element, bufferLength); // Write the record final RandomAccessFile data = getDataAccess(element.getObjectKey()); synchronized (data) { data.seek(marker.getPosition()); data.write(buffer.toByteArray(), 0, bufferLength); } return marker; }
/** * Write the given element to disk, and return the associated marker. * * @param element to write * @return marker representing the element * @throws java.io.IOException on write error */ protected DiskMarker write(Element element) throws IOException { MemoryEfficientByteArrayOutputStream buffer = serializeElement(element); int bufferLength = buffer.size(); elementSize = bufferLength; DiskMarker marker = alloc(element, bufferLength); // Write the record final RandomAccessFile data = getDataAccess(element.getObjectKey()); synchronized (data) { data.seek(marker.getPosition()); data.write(buffer.toByteArray(), 0, bufferLength); } return marker; }