private RefCountedMemory serialize(V value) { long serializedSize = serializer.serializedSize(value); if (serializedSize > Integer.MAX_VALUE) throw new IllegalArgumentException(String.format("Unable to allocate %s", FBUtilities.prettyPrintMemory(serializedSize))); RefCountedMemory freeableMemory; try { freeableMemory = new RefCountedMemory(serializedSize); } catch (OutOfMemoryError e) { return null; } try { serializer.serialize(value, new WrappedDataOutputStreamPlus(new MemoryOutputStream(freeableMemory))); } catch (IOException e) { freeableMemory.unreference(); throw new RuntimeException(e); } return freeableMemory; }
private RefCountedMemory serialize(V value) { long serializedSize = serializer.serializedSize(value); if (serializedSize > Integer.MAX_VALUE) throw new IllegalArgumentException(String.format("Unable to allocate %s", FBUtilities.prettyPrintMemory(serializedSize))); RefCountedMemory freeableMemory; try { freeableMemory = new RefCountedMemory(serializedSize); } catch (OutOfMemoryError e) { return null; } try { serializer.serialize(value, new WrappedDataOutputStreamPlus(new MemoryOutputStream(freeableMemory))); } catch (IOException e) { freeableMemory.unreference(); throw new RuntimeException(e); } return freeableMemory; }
private RefCountedMemory serialize(V value) { long serializedSize = serializer.serializedSize(value, ENCODED_TYPE_SIZES); if (serializedSize > Integer.MAX_VALUE) throw new IllegalArgumentException("Unable to allocate " + serializedSize + " bytes"); RefCountedMemory freeableMemory; try { freeableMemory = new RefCountedMemory(serializedSize); } catch (OutOfMemoryError e) { return null; } try { serializer.serialize(value, new EncodedDataOutputStream(new MemoryOutputStream(freeableMemory))); } catch (IOException e) { freeableMemory.unreference(); throw new RuntimeException(e); } return freeableMemory; }
private RefCountedMemory serialize(V value) { long serializedSize = serializer.serializedSize(value); if (serializedSize > Integer.MAX_VALUE) throw new IllegalArgumentException(String.format("Unable to allocate %s", FBUtilities.prettyPrintMemory(serializedSize))); RefCountedMemory freeableMemory; try { freeableMemory = new RefCountedMemory(serializedSize); } catch (OutOfMemoryError e) { return null; } try { serializer.serialize(value, new WrappedDataOutputStreamPlus(new MemoryOutputStream(freeableMemory))); } catch (IOException e) { freeableMemory.unreference(); throw new RuntimeException(e); } return freeableMemory; }
FBUtilities.copy(in, new MemoryOutputStream(offsets), offsets.size()); FBUtilities.copy(in, new MemoryOutputStream(entries), entries.size());
try FBUtilities.copy(in, new MemoryOutputStream(offsets), offsets.size()); FBUtilities.copy(in, new MemoryOutputStream(entries), entries.size());
try FBUtilities.copy(in, new MemoryOutputStream(offsets), offsets.size()); FBUtilities.copy(in, new MemoryOutputStream(entries), entries.size());
try FBUtilities.copy(in, new MemoryOutputStream(offsets), offsets.size()); FBUtilities.copy(in, new MemoryOutputStream(entries), entries.size());
try FBUtilities.copy(in, new MemoryOutputStream(offsets), offsets.size()); FBUtilities.copy(in, new MemoryOutputStream(entries), entries.size());