/** * Encode and write a {@link Node} to the {@link ObjectFile}. * Uses the given {@link ByteBuffer} for encoding space if possible. * Returns the location, suitable for use with {@link #fetchDecode}. */ public static long encodeStore(Node node, ObjectFile file, ByteBuffer bb) { int maxSize = nodec.maxSize(node); if ( bb == null ) return allocEncodeWrite(node, file, maxSize); if ( bb.capacity() < maxSize ) // Buffer may not be big enough. return allocEncodeWrite(node, file, maxSize); // Use buffer provided. bb.clear(); return encodeWrite(node, file, bb); }