@Override public long writeSnapshot(OutputStream outputStream) throws Exception { StreamUtil.write(indexBuffer, outputStream); return indexBuffer.capacity(); }
/** * Writes the {@link DirectBuffer#capacity} bytes given buffer to the destination output. * * @param source buffer to write * @param destination output to write to * @throws IOException */ public static void write(final DirectBuffer source, final OutputStream destination) throws IOException { write(source, destination, 0, source.capacity()); }
@Override public long writeSnapshot(OutputStream outputStream) throws Exception { StreamUtil.write(indexBuffer, outputStream); return indexBuffer.capacity(); }
/** * Writes the {@link DirectBuffer#capacity} bytes given buffer to the destination output. * * @param source buffer to write * @param destination output to write to * @throws IOException */ public static void write(final DirectBuffer source, final OutputStream destination) throws IOException { write(source, destination, 0, source.capacity()); }
public static void write( final File file, final InputStream data, final MessageDigest messageDigest) throws IOException { try (DigestOutputStream os = new DigestOutputStream(new FileOutputStream(file), messageDigest)) { copy(data, os); } final String digest = digestAsHex(messageDigest); final String fileName = file.getName(); final String content = String.format("%s %s", digest, fileName); final String algorithm = messageDigest.getAlgorithm().toLowerCase(); final String targetFileName = String.format("%s.%s", file.getAbsolutePath(), algorithm); write(new File(targetFileName), content); }
public static void write( final File file, final InputStream data, final MessageDigest messageDigest) throws IOException { try (DigestOutputStream os = new DigestOutputStream(new FileOutputStream(file), messageDigest)) { copy(data, os); } final String digest = digestAsHex(messageDigest); final String fileName = file.getName(); final String content = String.format("%s %s", digest, fileName); final String algorithm = messageDigest.getAlgorithm().toLowerCase(); final String targetFileName = String.format("%s.%s", file.getAbsolutePath(), algorithm); write(new File(targetFileName), content); }