Search in sources :

Example 1 with SwiftReadFeature

use of ch.cyberduck.core.openstack.SwiftReadFeature in project cyberduck by iterate-ch.

the class CryptoSwiftSingleTransferWorkerTest method testUpload.

@Test
public void testUpload() throws Exception {
    final Path home = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory));
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path dir1 = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Local localDirectory1 = new Local(System.getProperty("java.io.tmpdir"), new AlphanumericRandomStringService().random());
    new DefaultLocalDirectoryFeature().mkdir(localDirectory1);
    final byte[] content = RandomUtils.nextBytes(62768);
    final Path file1 = new Path(dir1, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final Local localFile1 = new Local(localDirectory1, file1.getName());
    final OutputStream out1 = localFile1.getOutputStream(false);
    IOUtils.write(content, out1);
    out1.close();
    final Path file2 = new Path(dir1, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final Local localFile2 = new Local(localDirectory1, file2.getName());
    final OutputStream out2 = localFile2.getOutputStream(false);
    IOUtils.write(content, out2);
    out2.close();
    final CryptoVault cryptomator = new CryptoVault(vault);
    cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
    session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final Transfer t = new UploadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(dir1, localDirectory1)), new NullFilter<>());
    assertTrue(new SingleTransferWorker(session, session, t, new TransferOptions(), new TransferSpeedometer(t), new DisabledTransferPrompt() {

        @Override
        public TransferAction prompt(final TransferItem file) {
            return TransferAction.overwrite;
        }
    }, new DisabledTransferErrorCallback(), new DisabledProgressListener(), new DisabledStreamListener(), new DisabledLoginCallback(), new DisabledNotificationService()) {
    }.run(session));
    assertTrue(new CryptoFindFeature(session, new SwiftFindFeature(session), cryptomator).find(dir1));
    assertEquals(content.length, new CryptoAttributesFeature(session, new DefaultAttributesFinderFeature(session), cryptomator).find(file1).getSize());
    {
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
        final InputStream in = new CryptoReadFeature(session, new SwiftReadFeature(session, new SwiftRegionService(session)), cryptomator).read(file1, new TransferStatus().withLength(content.length), new DisabledConnectionCallback());
        new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(in, buffer);
        assertArrayEquals(content, buffer.toByteArray());
    }
    assertEquals(content.length, new CryptoAttributesFeature(session, new DefaultAttributesFinderFeature(session), cryptomator).find(file2).getSize());
    {
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
        final InputStream in = new CryptoReadFeature(session, new SwiftReadFeature(session, new SwiftRegionService(session)), cryptomator).read(file1, new TransferStatus().withLength(content.length), new DisabledConnectionCallback());
        new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(in, buffer);
        assertArrayEquals(content, buffer.toByteArray());
    }
    cryptomator.getFeature(session, Delete.class, new SwiftDeleteFeature(session)).delete(Arrays.asList(file1, file2, dir1, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    localFile1.delete();
    localFile2.delete();
    localDirectory1.delete();
}
Also used : Delete(ch.cyberduck.core.features.Delete) TestProtocol(ch.cyberduck.core.TestProtocol) TransferAction(ch.cyberduck.core.transfer.TransferAction) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) SingleTransferWorker(ch.cyberduck.core.worker.SingleTransferWorker) TransferOptions(ch.cyberduck.core.transfer.TransferOptions) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) SwiftDeleteFeature(ch.cyberduck.core.openstack.SwiftDeleteFeature) DefaultLocalDirectoryFeature(ch.cyberduck.core.local.DefaultLocalDirectoryFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) CryptoReadFeature(ch.cyberduck.core.cryptomator.features.CryptoReadFeature) DisabledTransferErrorCallback(ch.cyberduck.core.transfer.DisabledTransferErrorCallback) SwiftFindFeature(ch.cyberduck.core.openstack.SwiftFindFeature) Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) DisabledNotificationService(ch.cyberduck.core.notification.DisabledNotificationService) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) SwiftReadFeature(ch.cyberduck.core.openstack.SwiftReadFeature) DisabledStreamListener(ch.cyberduck.core.io.DisabledStreamListener) InputStream(java.io.InputStream) Local(ch.cyberduck.core.Local) Host(ch.cyberduck.core.Host) ByteArrayOutputStream(java.io.ByteArrayOutputStream) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) CryptoAttributesFeature(ch.cyberduck.core.cryptomator.features.CryptoAttributesFeature) DisabledTransferPrompt(ch.cyberduck.core.transfer.DisabledTransferPrompt) DefaultAttributesFinderFeature(ch.cyberduck.core.shared.DefaultAttributesFinderFeature) SwiftRegionService(ch.cyberduck.core.openstack.SwiftRegionService) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) Transfer(ch.cyberduck.core.transfer.Transfer) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) TransferSpeedometer(ch.cyberduck.core.transfer.TransferSpeedometer) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) TransferItem(ch.cyberduck.core.transfer.TransferItem) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) StreamCopier(ch.cyberduck.core.io.StreamCopier) AbstractSwiftTest(ch.cyberduck.core.openstack.AbstractSwiftTest) IntegrationTest(ch.cyberduck.test.IntegrationTest) Test(org.junit.Test)

Example 2 with SwiftReadFeature

use of ch.cyberduck.core.openstack.SwiftReadFeature in project cyberduck by iterate-ch.

the class SwiftLargeObjectUploadFeatureTest method testLargeObjectUpload.

@Test
public void testLargeObjectUpload() throws Exception {
    // 5L * 1024L * 1024L
    final Path home = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory));
    home.attributes().setRegion("IAD");
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault);
    cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
    session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final SwiftRegionService regionService = new SwiftRegionService(session);
    final CryptoUploadFeature m = new CryptoUploadFeature<>(session, new SwiftLargeObjectUploadFeature(session, regionService, new SwiftWriteFeature(session, regionService), 5242880L, 5), new SwiftWriteFeature(session, regionService), cryptomator);
    final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    final int length = 5242885;
    final byte[] content = RandomUtils.nextBytes(length);
    IOUtils.write(content, local.getOutputStream(false));
    final TransferStatus writeStatus = new TransferStatus();
    final FileHeader header = cryptomator.getFileHeaderCryptor().create();
    writeStatus.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header));
    writeStatus.setLength(content.length);
    final BytecountStreamListener count = new BytecountStreamListener();
    m.upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), count, writeStatus, null);
    assertEquals(content.length, count.getSent());
    assertTrue(writeStatus.isComplete());
    assertTrue(new CryptoFindFeature(session, new SwiftFindFeature(session), cryptomator).find(test));
    assertEquals(content.length, new CryptoListService(session, new SwiftListService(session, regionService), cryptomator).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize());
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
    final TransferStatus readStatus = new TransferStatus().withLength(content.length);
    final InputStream in = new CryptoReadFeature(session, new SwiftReadFeature(session, regionService), cryptomator).read(test, readStatus, new DisabledConnectionCallback());
    new StreamCopier(readStatus, readStatus).transfer(in, buffer);
    assertArrayEquals(content, buffer.toByteArray());
    cryptomator.getFeature(session, Delete.class, new SwiftDeleteFeature(session)).delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    local.delete();
    session.close();
}
Also used : Delete(ch.cyberduck.core.features.Delete) CryptoListService(ch.cyberduck.core.cryptomator.features.CryptoListService) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) SwiftWriteFeature(ch.cyberduck.core.openstack.SwiftWriteFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) SwiftDeleteFeature(ch.cyberduck.core.openstack.SwiftDeleteFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) CryptoReadFeature(ch.cyberduck.core.cryptomator.features.CryptoReadFeature) FileHeader(org.cryptomator.cryptolib.api.FileHeader) CryptoUploadFeature(ch.cyberduck.core.cryptomator.features.CryptoUploadFeature) SwiftFindFeature(ch.cyberduck.core.openstack.SwiftFindFeature) Path(ch.cyberduck.core.Path) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) SwiftReadFeature(ch.cyberduck.core.openstack.SwiftReadFeature) InputStream(java.io.InputStream) Local(ch.cyberduck.core.Local) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BytecountStreamListener(ch.cyberduck.core.BytecountStreamListener) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) SwiftRegionService(ch.cyberduck.core.openstack.SwiftRegionService) BandwidthThrottle(ch.cyberduck.core.io.BandwidthThrottle) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) SwiftLargeObjectUploadFeature(ch.cyberduck.core.openstack.SwiftLargeObjectUploadFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) StreamCopier(ch.cyberduck.core.io.StreamCopier) SwiftListService(ch.cyberduck.core.openstack.SwiftListService) AbstractSwiftTest(ch.cyberduck.core.openstack.AbstractSwiftTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 3 with SwiftReadFeature

use of ch.cyberduck.core.openstack.SwiftReadFeature in project cyberduck by iterate-ch.

the class SwiftLargeUploadWriteFeatureTest method testWrite.

@Test
public void testWrite() throws Exception {
    final Path home = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory));
    home.attributes().setRegion("IAD");
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault);
    cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
    session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final SwiftRegionService regionService = new SwiftRegionService(session);
    final CryptoWriteFeature feature = new CryptoWriteFeature<>(session, new SwiftLargeUploadWriteFeature(session, regionService, new SwiftSegmentService(session, ".segments-test/")), cryptomator);
    final TransferStatus writeStatus = new TransferStatus();
    final FileHeader header = cryptomator.getFileHeaderCryptor().create();
    writeStatus.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header));
    writeStatus.setNonces(new RandomNonceGenerator());
    writeStatus.setLength(-1L);
    final OutputStream out = feature.write(test, writeStatus, new DisabledConnectionCallback());
    final byte[] content = RandomUtils.nextBytes(6 * 1024 * 1024);
    final ByteArrayInputStream in = new ByteArrayInputStream(content);
    final TransferStatus progress = new TransferStatus();
    final BytecountStreamListener listener = new BytecountStreamListener();
    new StreamCopier(new TransferStatus(), progress).withListener(listener).transfer(in, out);
    assertEquals(content.length, listener.getSent());
    assertTrue(new CryptoFindFeature(session, new SwiftFindFeature(session), cryptomator).find(test));
    final byte[] compare = new byte[content.length];
    final InputStream stream = new CryptoReadFeature(session, new SwiftReadFeature(session, regionService), cryptomator).read(test, new TransferStatus().withLength(content.length), new DisabledConnectionCallback());
    IOUtils.readFully(stream, compare);
    stream.close();
    assertArrayEquals(content, compare);
    cryptomator.getFeature(session, Delete.class, new SwiftDeleteFeature(session)).delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}
Also used : Delete(ch.cyberduck.core.features.Delete) CryptoWriteFeature(ch.cyberduck.core.cryptomator.features.CryptoWriteFeature) OutputStream(java.io.OutputStream) SwiftSegmentService(ch.cyberduck.core.openstack.SwiftSegmentService) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) SwiftDeleteFeature(ch.cyberduck.core.openstack.SwiftDeleteFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) CryptoReadFeature(ch.cyberduck.core.cryptomator.features.CryptoReadFeature) FileHeader(org.cryptomator.cryptolib.api.FileHeader) SwiftFindFeature(ch.cyberduck.core.openstack.SwiftFindFeature) Path(ch.cyberduck.core.Path) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) SwiftReadFeature(ch.cyberduck.core.openstack.SwiftReadFeature) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) RandomNonceGenerator(ch.cyberduck.core.cryptomator.random.RandomNonceGenerator) BytecountStreamListener(ch.cyberduck.core.BytecountStreamListener) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) SwiftRegionService(ch.cyberduck.core.openstack.SwiftRegionService) SwiftLargeUploadWriteFeature(ch.cyberduck.core.openstack.SwiftLargeUploadWriteFeature) ByteArrayInputStream(java.io.ByteArrayInputStream) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) StreamCopier(ch.cyberduck.core.io.StreamCopier) AbstractSwiftTest(ch.cyberduck.core.openstack.AbstractSwiftTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 4 with SwiftReadFeature

use of ch.cyberduck.core.openstack.SwiftReadFeature in project cyberduck by iterate-ch.

the class SwiftWriteFeatureTest method testWrite.

@Test
public void testWrite() throws Exception {
    final TransferStatus status = new TransferStatus();
    final int length = 1048576;
    final byte[] content = RandomUtils.nextBytes(length);
    status.setLength(content.length);
    final Path home = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory));
    home.attributes().setRegion("IAD");
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault);
    cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
    session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final SwiftRegionService regionService = new SwiftRegionService(session);
    final CryptoWriteFeature<StorageObject> writer = new CryptoWriteFeature<StorageObject>(session, new SwiftWriteFeature(session, regionService), cryptomator);
    final FileHeader header = cryptomator.getFileHeaderCryptor().create();
    status.setHeader(cryptomator.getFileHeaderCryptor().encryptHeader(header));
    status.setNonces(new RotatingNonceGenerator(cryptomator.numberOfChunks(content.length)));
    status.setChecksum(writer.checksum(test, status).compute(new ByteArrayInputStream(content), status));
    final OutputStream out = writer.write(test, status, new DisabledConnectionCallback());
    assertNotNull(out);
    new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out);
    out.close();
    assertTrue(new CryptoFindFeature(session, new SwiftFindFeature(session), cryptomator).find(test));
    assertEquals(content.length, new CryptoListService(session, new SwiftListService(session, regionService), cryptomator).list(test.getParent(), new DisabledListProgressListener()).get(test).attributes().getSize());
    assertEquals(content.length, writer.append(test, status.withRemote(new PathAttributes().withSize(content.length))).size, 0L);
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
    final InputStream in = new CryptoReadFeature(session, new SwiftReadFeature(session, regionService), cryptomator).read(test, new TransferStatus().withLength(content.length), new DisabledConnectionCallback());
    new StreamCopier(status, status).transfer(in, buffer);
    assertArrayEquals(content, buffer.toByteArray());
    cryptomator.getFeature(session, Delete.class, new SwiftDeleteFeature(session)).delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}
Also used : Delete(ch.cyberduck.core.features.Delete) CryptoListService(ch.cyberduck.core.cryptomator.features.CryptoListService) CryptoWriteFeature(ch.cyberduck.core.cryptomator.features.CryptoWriteFeature) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) RotatingNonceGenerator(ch.cyberduck.core.cryptomator.random.RotatingNonceGenerator) SwiftWriteFeature(ch.cyberduck.core.openstack.SwiftWriteFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) SwiftDeleteFeature(ch.cyberduck.core.openstack.SwiftDeleteFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) CryptoReadFeature(ch.cyberduck.core.cryptomator.features.CryptoReadFeature) FileHeader(org.cryptomator.cryptolib.api.FileHeader) SwiftFindFeature(ch.cyberduck.core.openstack.SwiftFindFeature) Path(ch.cyberduck.core.Path) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) StorageObject(ch.iterate.openstack.swift.model.StorageObject) SwiftReadFeature(ch.cyberduck.core.openstack.SwiftReadFeature) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) PathAttributes(ch.cyberduck.core.PathAttributes) ByteArrayOutputStream(java.io.ByteArrayOutputStream) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) SwiftRegionService(ch.cyberduck.core.openstack.SwiftRegionService) ByteArrayInputStream(java.io.ByteArrayInputStream) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) StreamCopier(ch.cyberduck.core.io.StreamCopier) SwiftListService(ch.cyberduck.core.openstack.SwiftListService) AbstractSwiftTest(ch.cyberduck.core.openstack.AbstractSwiftTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)4 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)4 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)4 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)4 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)4 Path (ch.cyberduck.core.Path)4 CryptoFindFeature (ch.cyberduck.core.cryptomator.features.CryptoFindFeature)4 CryptoReadFeature (ch.cyberduck.core.cryptomator.features.CryptoReadFeature)4 Delete (ch.cyberduck.core.features.Delete)4 StreamCopier (ch.cyberduck.core.io.StreamCopier)4 AbstractSwiftTest (ch.cyberduck.core.openstack.AbstractSwiftTest)4 SwiftDeleteFeature (ch.cyberduck.core.openstack.SwiftDeleteFeature)4 SwiftFindFeature (ch.cyberduck.core.openstack.SwiftFindFeature)4 SwiftReadFeature (ch.cyberduck.core.openstack.SwiftReadFeature)4 SwiftRegionService (ch.cyberduck.core.openstack.SwiftRegionService)4 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)4 DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)4 VaultCredentials (ch.cyberduck.core.vault.VaultCredentials)4 IntegrationTest (ch.cyberduck.test.IntegrationTest)4 InputStream (java.io.InputStream)4