Package java.io

Examples of java.io.DataInputStream.available()


                                    break ;
                                }
                            }
                            while (dis.available() > 0) ;
                           
                            if (dis.available() > 0)
                            {
                                final X509Certificate cert = (X509Certificate)cf.generateCertificate(dis);
                                certificates.add(cert) ;
                            }
                        }
View Full Code Here


    private static Pair<ReplayPosition, Long> truncationRecordFromBlob(ByteBuffer bytes)
    {
        try
        {
            DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(bytes));
            return Pair.create(ReplayPosition.serializer.deserialize(in), in.available() > 0 ? in.readLong() : Long.MIN_VALUE);
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

            log.info("Got a message of type: " + msgType);
            assertEquals(msgType, type);

            // Read message
            final ByteArrayOutputStream baos = new ByteArrayOutputStream(3072);
            while (dis.available() > 0) {
                baos.write(dis.read());
            }
            log.info("Read " + baos.size() + " bytes");
            final byte[] respBytes = baos.toByteArray();
            assertNotNull(respBytes);
View Full Code Here

    private static Pair<ReplayPosition, Long> truncationRecordFromBlob(ByteBuffer bytes)
    {
        try
        {
            DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(bytes));
            return Pair.create(ReplayPosition.serializer.deserialize(in), in.available() > 0 ? in.readLong() : Long.MIN_VALUE);
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

      ArrayList<PVector> data, int nelem) {
    try {
      FileInputStream fis = new FileInputStream(parent.dataPath("") + filename);
      DataInputStream dis = new DataInputStream(fis);

      while (dis.available() > 2) {
        float x, y, z;
        x = y = z = 0;
        if (1 <= nelem)
          x = dis.readShort() / 100f;
        if (2 <= nelem)
View Full Code Here

      ArrayList<float[]> data, int nelem) {
    try {
      FileInputStream fis = new FileInputStream(parent.dataPath("") + filename);
      DataInputStream dis = new DataInputStream(fis);

      while (dis.available() > 2) {
        float[] loc = new float[nelem];
        for (int k = 0; k < nelem; k++)
          loc[k] = dis.readShort() / 100f;
        data.add(loc);
      }
View Full Code Here

      for (int n = 0; n < nsize; n++) {
        for (int k = 0; k < nsave; k++)
          //data[nelem * n + k] = dis.readShort() / 100f;
          data[nelem * n + k] = dis.readFloat();
        if (dis.available() <= 2)
          break;
      }

      fis.close();
    } catch (Exception e) {
View Full Code Here

  public static Set<SystemPermission> convertSystemPermissions(byte[] systempermissions) {
    ByteArrayInputStream bytes = new ByteArrayInputStream(systempermissions);
    DataInputStream in = new DataInputStream(bytes);
    Set<SystemPermission> toReturn = new HashSet<SystemPermission>();
    try {
      while (in.available() > 0)
        toReturn.add(SystemPermission.getPermissionById(in.readByte()));
    } catch (IOException e) {
      log.error("User database is corrupt; error converting system permissions", e);
      toReturn.clear();
    }
View Full Code Here

  protected static ByteBuffer loadProgram(String filename) {
    DataInputStream dis = new DataInputStream(Thread.currentThread().getContextClassLoader()
        .getResourceAsStream("shaders/" + filename));
    byte[] program = null;
    try {
      program = new byte[dis.available()];
      dis.readFully(program);
      dis.close();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

     * @exception IOException, if the Streams couldn't be created.
     **/
    private static InputStream fullStream ( String fname ) throws IOException {
        FileInputStream fis = new FileInputStream(fname);
        DataInputStream dis = new DataInputStream(fis);
        byte[] bytes = new byte[dis.available()];
        dis.readFully(bytes);
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        return bais;
    }
       
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.