Package java.io

Examples of java.io.DataOutputStream.writeByte()


                    out_stream.write(NULL);
                    out_stream.flush();
                    return out_stream.toByteArray();
                }
                if(obj instanceof MethodCall) {
                    out.writeByte(METHOD_CALL);
                    MethodCall call=(MethodCall)obj;
                    out.writeShort(call.getId());
                    Object[] args=call.getArgs();
                    if(args == null || args.length == 0) {
                        out.writeShort(0);
View Full Code Here


                        }
                    }
                }
                else if(obj instanceof Cache.Value) {
                    Cache.Value value=(Cache.Value)obj;
                    out.writeByte(VALUE);
                    out.writeLong(value.getTimeout());
                    Util.objectToStream(value.getValue(), out);
                }
                else {
                    out.writeByte(OBJ);
View Full Code Here

                    out.writeByte(VALUE);
                    out.writeLong(value.getTimeout());
                    Util.objectToStream(value.getValue(), out);
                }
                else {
                    out.writeByte(OBJ);
                    Util.objectToStream(obj, out);
                }
                out.flush();
                return out_stream.toByteArray();
            }
View Full Code Here

   */
  public static Index getIndex( final String host, final int port, final boolean randomAccess, final boolean documentSizes ) throws IOException, ClassNotFoundException {
    final Socket socket = new Socket( host, port == -1 ? DEFAULT_PORT : port );
    LOGGER.debug( "Accessing remote index at " + host + ":" + port + "..." );
    final DataOutputStream outputStream = new DataOutputStream( socket.getOutputStream() );
    outputStream.writeByte( GET_INDEX );
    outputStream.writeBoolean( randomAccess );
    outputStream.writeBoolean( documentSizes );
    outputStream.flush();
    Index index = (Index)BinIO.loadObject( socket.getInputStream() );
    socket.close();
View Full Code Here

  {
    ByteArrayOutputStream  baos = new ByteArrayOutputStream();
   
    DataOutputStream  dos = new DataOutputStream( baos );
 
    dos.writeByte( 1 )// version
    dos.writeByte( pos.getPositionType());
   
    pos.serialise( dos );
   
    dos.close();
View Full Code Here

    ByteArrayOutputStream  baos = new ByteArrayOutputStream();
   
    DataOutputStream  dos = new DataOutputStream( baos );
 
    dos.writeByte( 1 )// version
    dos.writeByte( pos.getPositionType());
   
    pos.serialise( dos );
   
    dos.close();
   
View Full Code Here

    try{
         ByteArrayOutputStream  baos = new ByteArrayOutputStream();
        
         DataOutputStream  dos = new DataOutputStream(baos);
        
         dos.writeByte( 0 )// version
        
         contact.exportContact( dos );
        
         dos.close();
        
View Full Code Here

                dos.writeBytes(" " + width);
                dos.writeBytes(" " + height);
                dos.writeBytes(" " + MAX_COLOR_VALUE + "\n");
                for (i = 0; i < data.length; i++) {
                    pixel = data[i];
                    dos.writeByte(pixel >>> 16);
                    dos.writeByte(pixel >>> 8);
                    dos.writeByte(pixel);
                }
            }
View Full Code Here

                dos.writeBytes(" " + height);
                dos.writeBytes(" " + MAX_COLOR_VALUE + "\n");
                for (i = 0; i < data.length; i++) {
                    pixel = data[i];
                    dos.writeByte(pixel >>> 16);
                    dos.writeByte(pixel >>> 8);
                    dos.writeByte(pixel);
                }
            }

            return baos.toByteArray();
View Full Code Here

                dos.writeBytes(" " + MAX_COLOR_VALUE + "\n");
                for (i = 0; i < data.length; i++) {
                    pixel = data[i];
                    dos.writeByte(pixel >>> 16);
                    dos.writeByte(pixel >>> 8);
                    dos.writeByte(pixel);
                }
            }

            return baos.toByteArray();
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.