@Override public void readFields(DataInput in) throws IOException { super.readFields(in); size = in.readInt(); binaryData = new int[size]; for (int i = 0; i < size; i++) { binaryData[i] = in.readInt(); } }
@Override public void write(DataOutput out) throws IOException { super.write(out); out.writeInt(size); for (int i = 0; i < size; i++) { out.writeInt(binaryData[i]); } }
@Override public Content createContent(String uri, ContentCreateOptions options, boolean copyCollections, boolean copyMetadata, boolean copyQuality) throws IOException { if (copyCollections || copyMetadata || copyQuality) { setContentOptions(options, copyCollections, copyMetadata, copyQuality); } if (isStreamable()) { InputStream is = null; try { is = getContentAsByteStream(); return ContentFactory.newUnBufferedContent(uri, is, options); } catch (Exception ex) { if (is != null) { is.close(); } throw new IOException("Error accessing large binary document " + uri + ", skipping...", ex); } } else { return ContentFactory.newContent(uri, getContentAsByteArray(), options); } } }
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); path = new Path(Text.readString(in)); offset = in.readLong(); size = in.readLong(); binaryOrigLen = in.readLong(); conf = new Configuration(); conf.readFields(in); }
@Override public void write(DataOutput out) throws IOException { super.write(out); Text.writeString(out, path.toString()); out.writeLong(offset); out.writeLong(size); out.writeLong(binaryOrigLen); conf.write(out); }