Package erjang.driver.IO

Examples of erjang.driver.IO.BARR


    EBinary bin;
    if ((bin=subject.testBinary()) == null || (count=n.testSmall()) == null) {
      throw ERT.badarg(subject, n);
    }
   
    BARR b = new BARR();
    for (int i = 0; i < count.value; i++) {
      try {
        bin.writeTo(b);
      } catch (IOException e) {
        throw new ErlangError(new EString(e.getMessage()));
      }
    }
   
    return new EBinary(b.toByteArray());   
  }
View Full Code Here


        }
      }
     
      @Override
      void visit(int aByte) {
        if (barr[0] == null) { barr[0] = new BARR(); }
        barr[0].write(aByte);
      }
     
    });
   
View Full Code Here

    EBinary bin;
    if ((bin = io_list.testBinary()) != null) {
      return bin.toByteBuffer();
    }
   
    @SuppressWarnings("resource")
    final BARR out = new BARR();
    io_list.visitIOList( new EIOListVisitor() {
     
      @Override
      public void visit(byte[] array, int off, int len) {
        out.write(array, off, len);
      }
     
      @Override
      void visit(int aByte) {
        out.write(aByte);
      }
     
    });
    return out.wrap();
  }
View Full Code Here

      return bin;
    }
   
    final int[] extra_bits = new int[1];
   
    @SuppressWarnings("resource")
    final BARR out = new BARR();
    io_list.visitIOList( new EIOListVisitor() {
     
      @Override
      public void visit(byte[] array, int off, int len) {
        if (extra_bits[0] != 0) throw ERT.badarg();
        out.write(array, off, len);
      }
     
      @Override
      void visit(int aByte) {
        if (extra_bits[0] != 0) throw ERT.badarg();
        out.write(aByte);
      }
     
      @Override
      public void visitBits(int bits, int bitCount) {
        out.write( bits << (8-bitCount) );
        extra_bits[0] = bitCount;
      }
     
    });
   
    ByteBuffer bb = out.wrap();
   
    if (extra_bits[0] == 0) {
      return new EBinary(bb.array(), 0, bb.limit());
    } else {
      return EBitString.make(bb.array(), 0, bb.limit()-1, extra_bits[0]);
View Full Code Here

TOP

Related Classes of erjang.driver.IO.BARR

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.