isCurr = new ResettableInputStream(fileOrig); isCurr = new InputSubstream(isCurr, req.getFileOffset(), req.getPartSize(),
@Override public int read() throws IOException { byte[] b = new byte[1]; int bytesRead = read(b, 0, 1); if (bytesRead == -1) return bytesRead; return b[0]; }
InputSubstream inputSubStream = null; try { inputSubStream = new InputSubstream( newResettableInputStream(file, fileNotFoundMsg) String checksum = TreeHashGenerator.calculateTreeHash(inputSubStream); byte[] binaryChecksum = BinaryUtils.fromHex(checksum); inputSubStream.reset(); UploadMultipartPartRequest req = new UploadMultipartPartRequest() .withAccountId(accountId)
InputSubstream in = new InputSubstream(repeatableFileInputStream, 10, 10, true); assertEquals(10, in.available()); byte[] buffer = new byte[5]; in.mark(1024); assertEquals(5, in.read(buffer)); assertEquals("12345", new String(buffer, StringUtils.UTF8)); assertEquals(5, in.available()); in.reset(); assertEquals(10, in.available()); assertEquals(5, in.read(buffer)); assertEquals("12345", new String(buffer, StringUtils.UTF8)); assertEquals(5, in.available()); assertEquals(5, in.read(buffer)); assertEquals("67890", new String(buffer, StringUtils.UTF8)); assertEquals(0, in.available());
/** Tests the simple use case for InputSubstream */ @Test public void testSimple() throws Exception { InputSubstream in = new InputSubstream(new ByteArrayInputStream( sampleData.getBytes(StringUtils.UTF8)), 10, 10, true); assertEquals(10, in.available()); byte[] buffer = new byte[10]; assertEquals(10, in.read(buffer)); assertEquals("1234567890", new String(buffer, StringUtils.UTF8)); assertEquals(0, in.available()); CountingInputStream countingStream = new CountingInputStream(new InputSubstream( new ByteArrayInputStream(sampleData.getBytes(StringUtils.UTF8)), 10, 10, true)); int c; System.out.print("Data: "); while ((c = countingStream.read()) > -1) { System.out.print((char) c); } System.out.println(); assertEquals(10, countingStream.getByteCount()); countingStream = new CountingInputStream(new InputSubstream(new ByteArrayInputStream( sampleData.getBytes(StringUtils.UTF8)), 10, 10, true)); byte[] bytes = new byte[1]; System.out.print("Data: "); while ((c = countingStream.read(bytes)) > -1) { System.out.print((char) bytes[0]); } System.out.println(); assertEquals(10, countingStream.getByteCount()); }
isCurr = new InputSubstream( isCurr, uploadPartRequest.getFileOffset(),
InputSubstream inputSubStream = null; try { inputSubStream = new InputSubstream( newResettableInputStream(file, fileNotFoundMsg) String checksum = TreeHashGenerator.calculateTreeHash(inputSubStream); byte[] binaryChecksum = BinaryUtils.fromHex(checksum); inputSubStream.reset(); UploadMultipartPartRequest req = new UploadMultipartPartRequest() .withAccountId(accountId)
@Override public int read() throws IOException { byte[] b = new byte[1]; int bytesRead = read(b, 0, 1); if (bytesRead == -1) return bytesRead; return b[0]; }
.withKey(key) .withUploadId(uploadId) .withInputStream(new InputSubstream(wrappedStream, 0, partSize, isLastPart)) .withPartNumber(partNumber++) .withPartSize(partSize);
@Override public int read() throws IOException { byte[] b = new byte[1]; int bytesRead = read(b, 0, 1); if (bytesRead == -1) return bytesRead; return b[0]; }
InputStream originalInputStream = request.getInputStream(); if (request.getFile() != null) { originalInputStream = new InputSubstream(new RepeatableFileInputStream( request.getFile()), request.getFileOffset(), request.getPartSize(), request.isLastPart()); originalInputStream = new InputSubstream(originalInputStream, 0, request.getPartSize(), false);
@Override public int read() throws IOException { byte[] b = new byte[1]; int bytesRead = read(b, 0, 1); if (bytesRead == -1) return bytesRead; return b[0]; }
isCurr = new ResettableInputStream(fileOrig); isCurr = new InputSubstream(isCurr, req.getFileOffset(), req.getPartSize(),
.withUploadId(uploadId) .withInputStream( new InputSubstream(putObjectRequest.getInputStream(), 0, partSize, isLastPart)) .withPartNumber(partNumber++)
} else if (uploadPartRequest.getFile() != null) { try { inputStream = new InputSubstream(new RepeatableFileInputStream( uploadPartRequest.getFile()), uploadPartRequest.getFileOffset(), partSize, true);
private InputSubstream newInputSubstream(File file, long startingPosition, long length) { InputSubstream in = null; try { in = new InputSubstream(new RepeatableFileInputStream(file), startingPosition, length, true); } catch (FileNotFoundException e) { throw new AmazonClientException("Unable to find file '" + file.getAbsolutePath() + "'", e); } return in; }
InputStream originalInputStream = request.getInputStream(); if (request.getFile() != null) { originalInputStream = new InputSubstream(new RepeatableFileInputStream( request.getFile()), request.getFileOffset(), request.getPartSize(), request.isLastPart()); originalInputStream = new InputSubstream(originalInputStream, 0, request.getPartSize(), false);
isCurr = new ResettableInputStream(fileOrig); isCurr = new InputSubstream(isCurr, req.getFileOffset(), req.getPartSize(),
isCurr = new ResettableInputStream(fileOrig); isCurr = new InputSubstream(isCurr, req.getFileOffset(), req.getPartSize(),
isCurr = new InputSubstream( isCurr, uploadPartRequest.getFileOffset(),