Package org.activeio.packet

Examples of org.activeio.packet.ByteArrayPacket


    /**
     * @see java.io.OutputStream#write(byte[], int, int)
     */
    public void write(byte[] b, int off, int len) throws IOException {
        channel.write(new ByteArrayPacket(b, off, len));
    }
View Full Code Here


    /**
     * @see java.io.OutputStream#write(byte[], int, int)
     */
    public void write(byte[] b, int off, int len) throws IOException {
        channel.write(new ByteArrayPacket(b, off, len));
    }
View Full Code Here

      nextAllocationSize = initialSize;
        current = allocate();
    }
   
    protected Packet allocate() {
      ByteArrayPacket packet = new ByteArrayPacket(new byte[nextAllocationSize]);
      nextAllocationSize <<= 3; // x by 8
        return packet;
    }
View Full Code Here

    private static final int DEFAULT_BUFFER_SIZE = 1024*64;
    private final Packet buffer;
    private final boolean enableDirectWrites;
   
    public WriteBufferedAsynchChannel(AsynchChannel channel) {
        this(channel, new ByteArrayPacket(new byte[DEFAULT_BUFFER_SIZE]));
    }
View Full Code Here

        byte data[] = new byte[recordInfo.getHeader().getPayloadLength()];

        LogFile logFile = recordInfo.getLogFileState().getLogFile();
        logFile.read(recordInfo.getDataOffset(), data);

        return new ByteArrayPacket(data);

    }
View Full Code Here

  public Packet read(RecordLocation location)
      throws InvalidRecordLocationException, IOException {
     
      try {
            LogRecord record = logger.get(null, toLong(location));
            return new ByteArrayPacket(record.data);           
    } catch (InvalidLogKeyException e) {
      throw new InvalidRecordLocationException(e.getMessage(), e);
    } catch (Exception e) {
      throw (IOException) new IOException("Journal write failed: " + e)
          .initCause(e);
View Full Code Here

            byte data[] = new byte[requestSize];
            for (int i = 0; i < data.length; i++) {
                data[i] = (byte) i;
            }
            requestPacket = new ByteArrayPacket(data);

            // Loop to ramp up the clients.

            long clientActivationDelay = rampUpTime / concurrentClients;
            for (int i = 0; i < concurrentClients && !shutdownLatch.attempt(clientActivationDelay); i++) {
View Full Code Here

            final byte data[] = new byte[DEFAULT_BUFFER_SIZE];
            final DatagramPacket packet = new DatagramPacket(data, data.length);
            socket.receive(packet);
           
            // A FilterPacket is used to provide the UdpDatagramContext via narrow.
            return new UDPFilterPacket(new ByteArrayPacket(data, 0, packet.getLength()), packet);
           
        } catch (SocketTimeoutException e) {
            return null;
        }
    }
View Full Code Here

            return null;
        }
    }

    private Packet allocatePacket() {
        return new ByteArrayPacket(new byte[DEFAULT_BUFFER_SIZE]);
    }
View Full Code Here

    static public Packet serialize(Object object) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(object);
        oos.close();
        return new ByteArrayPacket(baos.toByteArray());
    }
View Full Code Here

TOP

Related Classes of org.activeio.packet.ByteArrayPacket

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.