List of usage examples for java.io DataOutput write
void write(byte b[]) throws IOException;
b
. From source file:org.mhisoft.wallet.service.AttachmentService.java
/** * Write the file content to the dataout, which is the attachment store. * @param content//from w w w . j a v a 2 s .c o m * @param encryptor * @param dataOut * @param pos * @return * @throws IOException */ //return pos private long writeEncryptedContent(byte[] content, final PBEEncryptor encryptor, DataOutput dataOut, long pos) throws IOException { logger.fine("writeEncryptedContent"); PBEEncryptor.EncryptionResult ret = encryptor.encrypt(content); byte[] _byteEncrypted = ret.getEncryptedData(); /* cipherParameters size 4 bytes*/ byte[] cipherParameters = ret.getCipherParameters(); dataOut.writeInt(cipherParameters.length); //length is 100 bytes //logger.fine("\t cipherParameters length: " + cipherParameters.length); pos += 4; /* cipherParameters body*/ dataOut.write(cipherParameters); pos += cipherParameters.length; /* size of the content*/ logger.fine("\t size of the content: " + _byteEncrypted.length); dataOut.writeInt(_byteEncrypted.length); pos += 4; /* content */ dataOut.write(_byteEncrypted); pos += _byteEncrypted.length; return pos; }
From source file:org.mrgeo.utils.StringUtils.java
public static void write(String str, DataOutput out) throws IOException { if (str == null) { out.writeInt(-1);/*from w ww .j a v a2 s . co m*/ } else { byte[] data = str.getBytes("UTF-8"); out.writeInt(data.length); out.write(data); } }
From source file:org.xdi.oxauth.cert.fingerprint.FingerprintHelper.java
private static void writeDataWithLength(byte[] data, DataOutput byteBuffer) throws IOException { byteBuffer.writeInt(data.length);//from www. jav a 2 s . co m byteBuffer.write(data); }
From source file:srebrinb.compress.sevenzip.SevenZOutputFile.java
private void writeFolder(final DataOutput header, final SevenZArchiveEntry entry) throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); int numCoders = 0; for (final SevenZMethodConfiguration m : getContentMethods(entry)) { numCoders++;//from ww w. j a va 2s . c o m writeSingleCodec(m, bos); } writeUint64(header, numCoders); header.write(bos.toByteArray()); for (long i = 0; i < numCoders - 1; i++) { writeUint64(header, i + 1); writeUint64(header, i); } }
From source file:srebrinb.compress.sevenzip.SevenZOutputFile.java
private void writeSubStreamsInfo(final DataOutput header) throws IOException { header.write(NID.kSubStreamsInfo); ////from w w w . j a va 2 s. c o m // header.write(NID.kCRC); // header.write(1); // for (final SevenZArchiveEntry entry : files) { // if (entry.getHasCrc()) { // header.writeInt(Integer.reverseBytes(entry.getCrc())); // } // } // header.write(NID.kEnd); }
From source file:StorageEngineClient.MultiFormatStorageSplit.java
@Override public void write(DataOutput out) throws IOException { if (path == null || path.length == 0) { out.writeInt(0);/*from www. ja va 2 s .co m*/ } else { out.writeInt(path.length); for (int i = 0; i < path.length; i++) { int len = path[i].toString().length(); if (len == 0) { out.writeShort((short) 0); } else { out.writeShort((short) len); out.write(path[i].toString().getBytes()); } } } }
From source file:uk.bl.wa.hadoop.indexer.WritableSolrRecord.java
@Override public void write(DataOutput output) throws IOException { byte[] bytes = SerializationUtils.serialize(this.sr.getSolrDocument()); output.writeInt(bytes.length);/* w w w. j ava 2 s.c om*/ output.write(bytes); }