@Override public void write(int b) throws IOException { writeLength(1, socketStream); socketStream.write(b); md.update((byte) b); }
@Override public void write(int b) throws IOException { writeLength(1, socketStream); socketStream.write(b); md.update((byte) b); }
@Override public void write(int b) throws IOException { writeLength(1, socketStream); socketStream.write(b); md.update((byte) b); }
@Override public void write(byte[] b, int off, int len) throws IOException { // Send the value in iterations of BUFFER_SIZE int remainingBytes = len; while (remainingBytes > 0) { // want a common code path for byte[] and InputStream at the BlobServer // -> since for InputStream we don't know a total size beforehand, send lengths iteratively final int bytesToSend = Math.min(BUFFER_SIZE, remainingBytes); writeLength(bytesToSend, socketStream); socketStream.write(b, off, bytesToSend); // Update the message digest md.update(b, off, bytesToSend); remainingBytes -= bytesToSend; off += bytesToSend; } }
@Override public void write(byte[] b, int off, int len) throws IOException { // Send the value in iterations of BUFFER_SIZE int remainingBytes = len; while (remainingBytes > 0) { // want a common code path for byte[] and InputStream at the BlobServer // -> since for InputStream we don't know a total size beforehand, send lengths iteratively final int bytesToSend = Math.min(BUFFER_SIZE, remainingBytes); writeLength(bytesToSend, socketStream); socketStream.write(b, off, bytesToSend); // Update the message digest md.update(b, off, bytesToSend); remainingBytes -= bytesToSend; off += bytesToSend; } }
@Override public void write(byte[] b, int off, int len) throws IOException { // Send the value in iterations of BUFFER_SIZE int remainingBytes = len; while (remainingBytes > 0) { // want a common code path for byte[] and InputStream at the BlobServer // -> since for InputStream we don't know a total size beforehand, send lengths iteratively final int bytesToSend = Math.min(BUFFER_SIZE, remainingBytes); writeLength(bytesToSend, socketStream); socketStream.write(b, off, bytesToSend); // Update the message digest md.update(b, off, bytesToSend); remainingBytes -= bytesToSend; off += bytesToSend; } }
public BlobKey finish() throws IOException { // send -1 as the stream end writeLength(-1, socketStream); // Receive blob key and compare final InputStream is = this.socket.getInputStream(); return receiveAndCheckPutResponse(is, md, blobType); }
public BlobKey finish() throws IOException { // send -1 as the stream end writeLength(-1, socketStream); // Receive blob key and compare final InputStream is = this.socket.getInputStream(); return receiveAndCheckPutResponse(is, md, blobType); }
public BlobKey finish() throws IOException { // send -1 as the stream end writeLength(-1, socketStream); // Receive blob key and compare final InputStream is = this.socket.getInputStream(); return receiveAndCheckPutResponse(is, md, blobType); }
/** * Writes to the output stream the error return code, and the given exception in serialized form. * * @param out Thr output stream to write to. * @param t The exception to send. * @throws IOException Thrown, if the output stream could not be written to. */ private static void writeErrorToStream(OutputStream out, Throwable t) throws IOException { byte[] bytes = InstantiationUtil.serializeObject(t); out.write(RETURN_ERROR); writeLength(bytes.length, out); out.write(bytes); } }
/** * Writes to the output stream the error return code, and the given exception in serialized form. * * @param out Thr output stream to write to. * @param t The exception to send. * @throws IOException Thrown, if the output stream could not be written to. */ private static void writeErrorToStream(OutputStream out, Throwable t) throws IOException { byte[] bytes = InstantiationUtil.serializeObject(t); out.write(RETURN_ERROR); writeLength(bytes.length, out); out.write(bytes); } }
/** * Writes to the output stream the error return code, and the given exception in serialized form. * * @param out Thr output stream to write to. * @param t The exception to send. * @throws IOException Thrown, if the output stream could not be written to. */ private static void writeErrorToStream(OutputStream out, Throwable t) throws IOException { byte[] bytes = InstantiationUtil.serializeObject(t); out.write(RETURN_ERROR); writeLength(bytes.length, out); out.write(bytes); } }
/** * Writes to the output stream the error return code, and the given exception in serialized form. * * @param out Thr output stream to write to. * @param t The exception to send. * @throws IOException Thrown, if the output stream could not be written to. */ private static void writeErrorToStream(OutputStream out, Throwable t) throws IOException { byte[] bytes = InstantiationUtil.serializeObject(t); out.write(RETURN_ERROR); writeLength(bytes.length, out); out.write(bytes); } }
byte[] keyBytes = key.getBytes(BlobUtils.DEFAULT_CHARSET); outputStream.write(idBytes); writeLength(keyBytes.length, outputStream); outputStream.write(keyBytes);
writeLength(keyBytes.length, outputStream); outputStream.write(keyBytes);
writeLength(bytesToSend, os); writeLength(-1, os);
if (read < 0) { writeLength(-1, os); break; writeLength(read, os); os.write(xferBuf, 0, read); if (md != null) {
byte[] keyBytes = key.getBytes(BlobUtils.DEFAULT_CHARSET); outputStream.write(idBytes); writeLength(keyBytes.length, outputStream); outputStream.write(keyBytes);
writeLength(blobLen, outputStream);
writeLength(blobLen, outputStream);