/** * Constructs and writes the header data for a PUT request to the given output stream. * * @param outputStream * the output stream to write the PUT header data to * @param jobId * the ID of job the BLOB belongs to (or <tt>null</tt> if job-unrelated) * @param blobType * whether the BLOB should become permanent or transient * * @throws IOException * thrown if an I/O error occurs while writing the header data to the output stream */ private static void sendPutHeader( OutputStream outputStream, @Nullable JobID jobId, BlobKey.BlobType blobType) throws IOException { // Signal type of operation outputStream.write(PUT_OPERATION); if (jobId == null) { outputStream.write(JOB_UNRELATED_CONTENT); } else { outputStream.write(JOB_RELATED_CONTENT); outputStream.write(jobId.getBytes()); } outputStream.write(blobType.ordinal()); }
/** * Constructs and writes the header data for a PUT request to the given output stream. * * @param outputStream * the output stream to write the PUT header data to * @param jobId * the ID of job the BLOB belongs to (or <tt>null</tt> if job-unrelated) * @param blobType * whether the BLOB should become permanent or transient * * @throws IOException * thrown if an I/O error occurs while writing the header data to the output stream */ private static void sendPutHeader( OutputStream outputStream, @Nullable JobID jobId, BlobKey.BlobType blobType) throws IOException { // Signal type of operation outputStream.write(PUT_OPERATION); if (jobId == null) { outputStream.write(JOB_UNRELATED_CONTENT); } else { outputStream.write(JOB_RELATED_CONTENT); outputStream.write(jobId.getBytes()); } outputStream.write(blobType.ordinal()); }
outputStream.write(NAME_ADDRESSABLE); byte[] idBytes = jobID.getBytes(); byte[] keyBytes = key.getBytes(BlobUtils.DEFAULT_CHARSET); outputStream.write(idBytes);
/** * Constructs and writes the header data for a PUT request to the given output stream. * * @param outputStream * the output stream to write the PUT header data to * @param jobId * the ID of job the BLOB belongs to (or <tt>null</tt> if job-unrelated) * @param blobType * whether the BLOB should become permanent or transient * * @throws IOException * thrown if an I/O error occurs while writing the header data to the output stream */ private static void sendPutHeader( OutputStream outputStream, @Nullable JobID jobId, BlobKey.BlobType blobType) throws IOException { // Signal type of operation outputStream.write(PUT_OPERATION); if (jobId == null) { outputStream.write(JOB_UNRELATED_CONTENT); } else { outputStream.write(JOB_RELATED_CONTENT); outputStream.write(jobId.getBytes()); } outputStream.write(blobType.ordinal()); }
/** * Constructs and writes the header data for a GET operation to the given output stream. * * @param outputStream * the output stream to write the header data to * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param blobKey * blob key associated with the requested file * * @throws IOException * thrown if an I/O error occurs while writing the header data to the output stream */ private static void sendGetHeader( OutputStream outputStream, @Nullable JobID jobId, BlobKey blobKey) throws IOException { checkNotNull(blobKey); checkArgument(jobId != null || blobKey instanceof TransientBlobKey, "permanent BLOBs must be job-related"); // Signal type of operation outputStream.write(GET_OPERATION); // Send job ID and key if (jobId == null) { outputStream.write(JOB_UNRELATED_CONTENT); } else { outputStream.write(JOB_RELATED_CONTENT); outputStream.write(jobId.getBytes()); } blobKey.writeToOutputStream(outputStream); }
outputStream.write(NAME_ADDRESSABLE); outputStream.write(jobID.getBytes()); byte[] keyBytes = key.getBytes(BlobUtils.DEFAULT_CHARSET); writeLength(keyBytes.length, outputStream);
/** * Constructs and writes the header data for a GET operation to the given output stream. * * @param outputStream * the output stream to write the header data to * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param blobKey * blob key associated with the requested file * * @throws IOException * thrown if an I/O error occurs while writing the header data to the output stream */ private static void sendGetHeader( OutputStream outputStream, @Nullable JobID jobId, BlobKey blobKey) throws IOException { checkNotNull(blobKey); checkArgument(jobId != null || blobKey instanceof TransientBlobKey, "permanent BLOBs must be job-related"); // Signal type of operation outputStream.write(GET_OPERATION); // Send job ID and key if (jobId == null) { outputStream.write(JOB_UNRELATED_CONTENT); } else { outputStream.write(JOB_RELATED_CONTENT); outputStream.write(jobId.getBytes()); } blobKey.writeToOutputStream(outputStream); }
/** * Constructs and writes the header data for a GET operation to the given output stream. * * @param outputStream * the output stream to write the header data to * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param blobKey * blob key associated with the requested file * * @throws IOException * thrown if an I/O error occurs while writing the header data to the output stream */ private static void sendGetHeader( OutputStream outputStream, @Nullable JobID jobId, BlobKey blobKey) throws IOException { checkNotNull(blobKey); checkArgument(jobId != null || blobKey instanceof TransientBlobKey, "permanent BLOBs must be job-related"); // Signal type of operation outputStream.write(GET_OPERATION); // Send job ID and key if (jobId == null) { outputStream.write(JOB_UNRELATED_CONTENT); } else { outputStream.write(JOB_RELATED_CONTENT); outputStream.write(jobId.getBytes()); } blobKey.writeToOutputStream(outputStream); }