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); }
BlobOutputStream(JobID jobID, BlobKey.BlobType blobType, Socket socket) throws IOException { this.blobType = blobType; if (socket.isClosed()) { throw new IllegalStateException("BLOB Client is not connected. " + "Client has been shut down or encountered an error before."); } this.socket = socket; this.socketStream = socket.getOutputStream(); this.md = BlobUtils.createMessageDigest(); sendPutHeader(socketStream, jobID, blobType); }
try (BlobOutputStream os = new BlobOutputStream(jobId, blobType, socket)) { os.write(value, offset, len); return os.finish(); } catch (Throwable t) { BlobUtils.closeSilently(socket, LOG);
private PermanentBlobKey uploadDirectory(JobID jobId, Path file, FileSystem fs) throws IOException { try (BlobOutputStream blobOutputStream = new BlobOutputStream(jobId, PERMANENT_BLOB, socket)) { try (ZipOutputStream zipStream = new ZipOutputStream(blobOutputStream)) { compressDirectoryToZipfile(fs, fs.getFileStatus(file), fs.getFileStatus(file), zipStream); zipStream.finish(); return (PermanentBlobKey) blobOutputStream.finish(); } } }
try (BlobOutputStream os = new BlobOutputStream(jobId, blobType, socket)) { os.write(value, offset, len); return os.finish(); } catch (Throwable t) { BlobUtils.closeSilently(socket, LOG);
try (BlobOutputStream os = new BlobOutputStream(jobId, blobType, socket)) { IOUtils.copyBytes(inputStream, os, BUFFER_SIZE, false); return os.finish(); } catch (Throwable t) { BlobUtils.closeSilently(socket, LOG);
try (BlobOutputStream os = new BlobOutputStream(jobId, blobType, socket)) { os.write(value, offset, len); return os.finish(); } catch (Throwable t) { BlobUtils.closeSilently(socket, LOG);
try (BlobOutputStream os = new BlobOutputStream(jobId, blobType, socket)) { IOUtils.copyBytes(inputStream, os, BUFFER_SIZE, false); return os.finish(); } catch (Throwable t) { BlobUtils.closeSilently(socket, LOG);
BlobOutputStream(JobID jobID, BlobKey.BlobType blobType, Socket socket) throws IOException { this.blobType = blobType; if (socket.isClosed()) { throw new IllegalStateException("BLOB Client is not connected. " + "Client has been shut down or encountered an error before."); } this.socket = socket; this.socketStream = socket.getOutputStream(); this.md = BlobUtils.createMessageDigest(); sendPutHeader(socketStream, jobID, 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); }
try (BlobOutputStream os = new BlobOutputStream(jobId, blobType, socket)) { IOUtils.copyBytes(inputStream, os, BUFFER_SIZE, false); return os.finish(); } catch (Throwable t) { BlobUtils.closeSilently(socket, LOG);
BlobOutputStream(JobID jobID, BlobKey.BlobType blobType, Socket socket) throws IOException { this.blobType = blobType; if (socket.isClosed()) { throw new IllegalStateException("BLOB Client is not connected. " + "Client has been shut down or encountered an error before."); } this.socket = socket; this.socketStream = socket.getOutputStream(); this.md = BlobUtils.createMessageDigest(); sendPutHeader(socketStream, jobID, 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); }