@Override public void writeExternal(ObjectOutput out) throws IOException { out.write(this.cardinality & 0xFF); out.write((this.cardinality >>> 8) & 0xFF); if (BufferUtil.isBackedBySimpleArray(content)) { short[] a = content.array(); for (int k = 0; k < this.cardinality; ++k) { out.writeShort(Short.reverseBytes(a[k])); } } else { for (int k = 0; k < this.cardinality; ++k) { out.writeShort(Short.reverseBytes(content.get(k))); } } }
@Override public void writeExternal(ObjectOutput out) throws IOException { byte[] bytes = getBytes(); out.writeInt(bytes.length); out.writeInt(this.numFields); out.write(bytes); }
protected void writePackager(ObjectOutput out) throws IOException { out.writeByte('P'); String pclass = packager.getClass().getName(); byte[] b = pclass.getBytes(); out.writeShort(b.length); out.write(b); }
@Override public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(2); out.writeInt(548); out.writeInt(348); byte[] bytes = new byte[1024]; for (int i = 0; i < 548; i++) { bytes[i] = 1; } out.write(bytes, 0, 548); bytes = new byte[1024]; for (int i = 0; i < 348; i++) { bytes[i] = 2; } out.write(bytes, 0, 348); }
// deprecated in ObjectOutputStream.PutField public void write(ObjectOutput out) throws IOException { /* * Applications should *not* use this method to write PutField * data, as it will lead to stream corruption if the PutField * object writes any primitive data (since block data mode is not * unset/set properly, as is done in OOS.writeFields()). This * broken implementation is being retained solely for behavioral * compatibility, in order to support applications which use * OOS.PutField.write() for writing only non-primitive data. * * Serialization of unshared objects is not implemented here since * it is not necessary for backwards compatibility; also, unshared * semantics may not be supported by the given ObjectOutput * instance. Applications which write unshared objects using the * PutField API must use OOS.writeFields(). */ if (InteropObjectOutputStream.this != out) { throw new IllegalArgumentException("wrong stream"); } out.write(primVals, 0, primVals.length); ObjectStreamField[] fields = desc.getFields(false); int numPrimFields = fields.length - objVals.length; // REMIND: warn if numPrimFields > 0? for (int i = 0; i < objVals.length; i++) { if (fields[numPrimFields + i].isUnshared()) { throw new IOException("cannot write unshared object"); } out.writeObject(objVals[i]); } }
protected void writeHeader(ObjectOutput out) throws IOException { int len = header.getLength(); if (len > 0) { out.writeByte('H'); out.writeShort(len); out.write(header.pack()); } }
@Override public void writeExternal(ObjectOutput out) throws IOException { FileSystemProto.Directory.Builder dirBuilder = FileSystemProto.Directory.newBuilder(); dirBuilder.setPath(getPath()); dirBuilder.setLastModified(getLastModified()); FileSystemProto.File.Builder fileBuilder = FileSystemProto.File.newBuilder(); for (CacheFileProto child : children) { fileBuilder.clear(); fileBuilder.setName(child.getShortName()); fileBuilder.setIsDirectory(child.isDirectory()); fileBuilder.setLastModified(child.getLastModified()); fileBuilder.setLength(child.getLength()); dirBuilder.addFiles(fileBuilder); } thredds.filesystem.FileSystemProto.Directory dirProto = dirBuilder.build(); byte[] b = dirProto.toByteArray(); out.writeInt(b.length); out.write(b); }
public void writeExternal(ObjectOutput out) throws IOException { out.write(this.opcode); }