Examples of markSupported()


Examples of java.io.InputStream.markSupported()

        byte[] src = "HELLO MINA".getBytes();
        byte[] dst = new byte[src.length];
        ByteBuffer bb = ByteBuffer.wrap(src);
        InputStream is = new ByteBufferInputStream(bb);

        assertEquals(true, is.markSupported());
        is.mark(src.length);
        assertEquals(dst.length, is.read(dst));
        assertArrayEquals(src, dst);
        assertEquals(-1, is.read());
        is.close();

Examples of java.io.InputStream.markSupported()

      {
          SanityManager.THROWASSERT("NDRDAType: " + ndrdaType +
                  " not valid EXTDTA object type");
      }
    }
  if (! is.markSupported()) {
      is = new BufferedInputStream(is);
      }
     
   this.binaryInputStream=is;
    }

Examples of java.io.InputStream.markSupported()

            hdrInfo = new HeaderInfo(hdrLen, valueLength);
            // Make sure the stream is correctly positioned.
            rewindStream((InputStream)in, hdrLen);
        } else {
            final InputStream srcIn = (InputStream)in;
            final boolean markSet = srcIn.markSupported();
            if (markSet) {
                srcIn.mark(MAX_STREAM_HEADER_LENGTH);
            }
            byte[] header = new byte[MAX_STREAM_HEADER_LENGTH];
            int read = in.read(header);

Examples of java.io.InputStream.markSupported()

  @Test
  public void testMarkSupported() throws IOException
  {
    InputStream data = new ByteArrayInputStream(DATA);
    CountingInputStream in = new CountingInputStream(data);
    assertEquals(data.markSupported(), in.markSupported());
  }

  @Test
  public void testMarkAndReset() throws IOException
  {

Examples of java.io.InputStream.markSupported()

    }
    os.close();

    final LZ4FastDecompressor decompressor = LZ4Factory.fastestInstance().fastDecompressor();
    InputStream is = new LZ4BlockInputStream(open(compressed.toByteArray()), decompressor, checksum);
    assertFalse(is.markSupported());
    try {
      is.mark(1);
      is.reset();
      assertFalse(true);
    } catch (IOException e) {

Examples of java.io.InputStream.markSupported()

  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);

Examples of java.io.InputStream.markSupported()

     
  }catch(IOException e){
      throw new IllegalStateException(e.getMessage());
  }
 
  if(! is.markSupported() ){
      is = new BufferedInputStream(is);
  }

  this.binaryInputStream = is;

Examples of java.io.InputStream.markSupported()

     */
    public void test_markSupported() {
        InputStream is = new ByteArrayInputStream(new byte[10]);
        InflaterInputStream iis = new InflaterInputStream(is);
        assertFalse(iis.markSupported());
        assertTrue(is.markSupported());
    }

  /**
     * @tests java.util.zip.InflaterInputStream#read()
     */
 

Examples of java.io.InputStream.markSupported()

                    return wrapped.available();
                }

                @Override
                public boolean markSupported() {
                    return wrapped.markSupported();
                }

                @Override
                public void mark(int readlimit) {
                    wrapped.mark(readlimit);

Examples of java.io.InputStream.markSupported()

                    return wrapped.available();
                }

                @Override
                public boolean markSupported() {
                    return wrapped.markSupported();
                }

                @Override
                public void mark(int readlimit) {
                    wrapped.mark(readlimit);
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.