Package java.io

Examples of java.io.BufferedInputStream


   }

   public byte[] getResourceContentAsBytes(String url) throws Exception
   {
      InputStream is = getInputStream(url);
      BufferedInputStream buffer = new BufferedInputStream(is);
      ByteArrayOutputStream output = new ByteArrayOutputStream();
      byte[] data = new byte[buffer.available()];
      int available = -1;
      while ((available = buffer.read(data)) > -1)
      {
         output.write(data, 0, available);
      }
      return output.toByteArray();
   }
View Full Code Here


    public BackwardsLineReader(InputStream is) {
        this(is, null);
    }

    public BackwardsLineReader(InputStream is, String encoding) {
        this.bis = new BufferedInputStream(is, 8192);
        this.encoding = encoding;
    }
View Full Code Here

    unackCounter = 0;
    this.inputCounter = inputCounter;
    this.sock = sock;

    nos = new NetOutputStream(sock);
    bis = new BufferedInputStream(sock.getInputStream());
  }
View Full Code Here

        long count = readCount.incrementAndGet();
        LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, batchManager.id, id, "reading batch from disk, total reads:", count); //$NON-NLS-1$
        try {
          this.batchManager.compactionLock.readLock().lock();
          long[] info = batchManager.physicalMapping.get(this.id);
          ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(batchManager.store.createInputStream(info[0]), IO_BUFFER_SIZE));
                batch = new TupleBatch();
                batch.setDataTypes(types);
                batch.readExternal(ois);
                batch.setRowOffset(this.beginRow);
              batch.setDataTypes(null);
View Full Code Here

            outputStream = new ObjectEncoderOutputStream( new DataOutputStream(bos), 512);
            //The output stream must be flushed on creation in order to write some initialization data
            //through the buffered stream to the input stream on the other side
            outputStream.flush();
            final ClassLoader cl = this.getClass().getClassLoader();
            BufferedInputStream bis = new BufferedInputStream(socket.getInputStream(), STREAM_BUFFER_SIZE);
            inputStream = new ObjectDecoderInputStream(new DataInputStream(bis), cl, MAX_OBJECT_SIZE);
    }
View Full Code Here

   * @param entry File/Entry to load
   * @return InputStream of specific Entry
   */
  protected InputStream getInputStream(String entry) {
    try {
      return new BufferedInputStream(new FileInputStream(new File(getBase(), entry)));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    return null;
  }
View Full Code Here

  public InputStream getInputStream() throws IOException {
    if (fsos != null && !fsos.bytesWritten()) {
      return new ByteArrayInputStream(fsos.getBuffer(), 0, fsos.getCount());
    }
    //TODO: adjust the buffer size, and/or develop a shared buffer strategy
    return new BufferedInputStream(lobBuffer.createInputStream(0));
  }
View Full Code Here

    /**
     * INTERNAL
     */
    public static InputStream readBlob(String fileName) throws IOException {
        return new BufferedInputStream(IOUtils.openFileInputStream(fileName));
    }
View Full Code Here

            try {
                inStream = IOUtils.openFileInputStream(file);
            } catch (IOException e) {
                throw DbException.convertIOException(e, file);
            }
            in = new BufferedInputStream(inStream, Constants.IO_BUFFER_SIZE);
            in = CompressTool.wrapInputStream(in, compressionAlgorithm, SCRIPT_SQL);
            if (in == null) {
                throw DbException.get(ErrorCode.FILE_NOT_FOUND_1, SCRIPT_SQL + " in " + file);
            }
        }
View Full Code Here

     * @throws IOException
     */
    public String getString(String charset) throws HttpConnectionException {
        try {
            StringBuffer sb = new StringBuffer();
            BufferedInputStream in = new BufferedInputStream(uc.getInputStream());
            InputStreamReader reader = charset != null ? new InputStreamReader(in, charset) : new InputStreamReader(in);
           
            int c;
            while ((c = reader.read()) != -1)
                sb.append((char) c);
   
            reader.close();
            in.close();
           
            return sb.toString();
        } catch (IOException ie) {
            throw new HttpConnectionException(ie);
        }
View Full Code Here

TOP

Related Classes of java.io.BufferedInputStream

Copyright © 2018 www.massapicom. 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.