Package java.io

Examples of java.io.InputStream.markSupported()


    public void testDbInputStreamReset() throws Exception {
        DataRecord record = store.getRecord(identifier);
        InputStream in = record.getStream();
        try {
            // test whether mark and reset works
            assertTrue(in.markSupported());
            in.mark(data.length);
            while (-1 != in.read()) {
                // loop
            }
            assertTrue(in.markSupported());
View Full Code Here


            assertTrue(in.markSupported());
            in.mark(data.length);
            while (-1 != in.read()) {
                // loop
            }
            assertTrue(in.markSupported());
            try {
                in.reset();
            } catch (Exception e) {
                fail("Unexpected exception while resetting input stream: " + e.getMessage());
            }
View Full Code Here

           
            }
           
        }
        else { badDRDAType( ndrdaType ); }
    if (! is.markSupported()) {
        is = new BufferedInputStream(is);
        }
       
    this.binaryInputStream=is;
    }
View Full Code Here

      @Override public void reset() throws IOException {
        delegate.reset();
      }
     
      @Override public boolean markSupported() {
        return delegate.markSupported();
      }
    };
  }
}
View Full Code Here

                }

                if ( entity != null ) {
                    InputStream content = entity.getContent();
                    if ( retryCount > 0 ) {
                        if ( content.markSupported() ) {
                            content.reset();
                            content.mark(-1);
                        }
                    } else {
                        if ( content.markSupported() ) {
View Full Code Here

                        if ( content.markSupported() ) {
                            content.reset();
                            content.mark(-1);
                        }
                    } else {
                        if ( content.markSupported() ) {
                            content.mark(-1);
                        }
                    }
                }
View Full Code Here

        if (progressListener != null) {
            input = new ProgressReportingInputStream(input, progressListener);
            fireProgressEvent(progressListener, ProgressEvent.STARTED_EVENT_CODE);
        }

        if (!input.markSupported()) {
            int streamBufferSize = Constants.DEFAULT_STREAM_BUFFER_SIZE;
            String bufferSizeOverride = System.getProperty("com.amazonaws.sdk.s3.defaultStreamBufferSize");
            if (bufferSizeOverride != null) {
                try {
                    streamBufferSize = Integer.parseInt(bufferSizeOverride);
View Full Code Here

             * specified a content type.
             */
            metadata.setContentType(Mimetypes.MIMETYPE_OCTET_STREAM);
        }

        if (!input.markSupported()) {
            input = new RepeatableInputStream(input, Constants.DEFAULT_STREAM_BUFFER_SIZE);
        }

        populateRequestMetadata(request, metadata);
        signRequest(request, HttpMethodName.PUT, bucketName, key);
View Full Code Here

  {
    InputStream input = _stream;
    if (!_stream.markSupported()) {
      input = new BufferedInputStream( input );
    }
    assert input.markSupported();

    return ENGINE_LOADER_FACTORY.newInstance( _config ).loadEngineData( _stream );
  }

  private static final EngineLoader.Factory ENGINE_LOADER_FACTORY = getLoaderFactory();
View Full Code Here

  throws IOException {
    InputStream in = fs.open(p);
    try {
      // I need to be able to move back in the stream if this is not a pb serialization so I can
      // do the Writable decoding instead.
      in = in.markSupported()? in: new BufferedInputStream(in);
      int pblen = ProtobufUtil.lengthOfPBMagic();
      in.mark(pblen);
      byte [] pbuf = new byte[pblen];
      int read = in.read(pbuf);
      if (read != pblen) throw new IOException("read=" + read + ", wanted=" + pblen);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.