Package java.io

Examples of java.io.InputStream.skip()


        }finally{
            out.close();
        }
        InputStream in = fs.getInput(filePath);
        try{
            long skipped = in.skip(2);
            assertEquals(skipped, 2);
            assertEquals(in.read(), 3);
        }finally{
            in.close();
        }
View Full Code Here


                    return wrapped.read(b, off, len);
                }

                @Override
                public long skip(long n) throws IOException {
                    return wrapped.skip(n);
                }

                @Override
                public int available() throws IOException {
                    return wrapped.available();
View Full Code Here

                    return wrapped.read(b, off, len);
                }

                @Override
                public long skip(long n) throws IOException {
                    return wrapped.skip(n);
                }

                @Override
                public int available() throws IOException {
                    return wrapped.available();
View Full Code Here

     */
    public void read(long fileOffset, ByteBuffer destBuf) throws IOException {
        final JarFileSystem fs = (JarFileSystem) getFileSystem();
        final JarFile jarFile = fs.getJarFile();
        final InputStream is = jarFile.getInputStream(entry.getJarEntry());
        is.skip(fileOffset);
        InputStreamChannel isc = new InputStreamChannel(is);
        isc.read(destBuf);
        isc.close();
        is.close();
    }
View Full Code Here

        assertTrue(rs.next());
        b = rs.getBlob("DATA");
        InputStream in = b.getBinaryStream();
        byte[] rspData = new byte[data.length];
        in.skip(offset-1);
        in.read(rspData);
        in.close();

        assertTrue("Request should be the same as the response", Arrays.equals(data, rspData));
View Full Code Here

        throws IOException
    {
        InputStream in = getInputStream();
        try
        {
            in.skip(start);
            if (count<0)
                IO.copy(in,out);
            else
                IO.copy(in,out,count);
        }
View Full Code Here

                        in=resource.getInputStream();
                        pos=0;
                    }
                    if (pos<start)
                    {
                        in.skip(start-pos);
                        pos=start;
                    }
                    IO.copy(in,multi,size);
                    pos+=size;
                }
View Full Code Here

    default:
      throw new IOException("Request not granted: " + result);
    }

    waitForData(is, 6);
    is.skip(2);
    if(this.address == null) {
      byte[] addr = new byte[4];
      if(is.read(addr) != 4)
        throw new IOException("Couldn't read address");
      this.address = InetAddress.getByAddress(addr);
View Full Code Here

      byte[] addr = new byte[4];
      if(is.read(addr) != 4)
        throw new IOException("Couldn't read address");
      this.address = InetAddress.getByAddress(addr);
    } else {
      is.skip(4);
    }
  }

  private void waitForData(InputStream is, int bytes) throws IOException {
    long start = System.currentTimeMillis();
View Full Code Here

    return ret;
  }

  private byte[] getFileData(int i, int length) throws IOException {
    InputStream in = new FileInputStream(exe);
    in.skip(i);
    byte[] ret = new byte[length];
    in.read(ret);
    in.close();
    return ret;
  }
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.