Package java.io

Examples of java.io.ObjectInputStream.readInt()


            outControl.writeInt(this.controlPort);
            outControl.flush();

            // For each node, add an entry to cluster nodes
            ObjectInputStream inData = new ObjectInputStream(in);
            int nodeCount = inData.readInt();
            for (int n = 0; n < nodeCount; n++)
                this.clusterAddresses.put(inData.readUTF(), new Date());

            inData.close();
            outControl.close();
View Full Code Here


    public void handleClusterSessionRequest(Socket socket, InputStream in,
            OutputStream out, HostGroup hostGroup)
            throws IOException {
        // Read in a string for the sessionId
        ObjectInputStream inControl = new ObjectInputStream(in);
        int port = inControl.readInt();
        String ipPortSender = socket.getInetAddress().getHostAddress() + ":" + port;
        String sessionId = inControl.readUTF();
        String hostname = inControl.readUTF();
        HostConfiguration hostConfig = hostGroup.getHostByName(hostname);
        String webAppPrefix = inControl.readUTF();
View Full Code Here

    public void handleNodeListDownloadRequest(Socket socket, InputStream in,
            OutputStream out) throws IOException {
        // Get the ip and port of the requester, and make sure we don't send
        // that
        ObjectInputStream inControl = new ObjectInputStream(in);
        int port = inControl.readInt();
        String ipPortSender = socket.getInetAddress().getHostAddress() + ":"
                + port;
        List allClusterNodes = new ArrayList(this.clusterAddresses.keySet());
        List relevantClusterNodes = new ArrayList();
        for (Iterator i = allClusterNodes.iterator(); i.hasNext();) {
View Full Code Here

     * Handles heartbeats. Just updates the date of this node's last heartbeat
     */
    public void handleNodeHeartBeatRequest(Socket socket, InputStream in)
            throws IOException {
        ObjectInputStream inData = new ObjectInputStream(in);
        int remoteControlPort = inData.readInt();
        inData.close();
        String ipPort = socket.getInetAddress().getHostAddress() + ":"
                + remoteControlPort;
        this.clusterAddresses.put(ipPort, new Date());
        Logger.log(Logger.FULL_DEBUG, CLUSTER_RESOURCES,
View Full Code Here

            Socket s = new Socket(host, port);
            try
            {
                ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
                ObjectInputStream in = new ObjectInputStream(s.getInputStream());
                int protocolVersion = in.readInt();
                if(protocolVersion > 220)
                {
                    throw new IOException(
                        "Incompatible protocol version " + protocolVersion +
                        ". At most 220 was expected.");
View Full Code Here

      ObjectOutputStream ooStream = new ObjectOutputStream(oStream);

      int i = 0;
      byte[] buffer = null;
      while (true) {
        int size = oiStream.readInt();
        transferred += 4;

        if (size == 0)
          break;
View Full Code Here

            // check for binary properties
            Map<String, Object> binaryProperties = new HashMap<String, Object>();
            final ObjectInputStream ois = vm.get("slingevent:properties", ObjectInputStream.class);
            if ( ois != null ) {
                try {
                    int length = ois.readInt();
                    for(int i=0;i<length;i++) {
                        final String key = (String)ois.readObject();
                        final Object value = ois.readObject();
                        binaryProperties.put(key, value);
                    }
View Full Code Here

        List<RegisteredResource> unknownList = null;
        if ( dataFile.exists() ) {
            ObjectInputStream ois = null;
            try {
                ois = new ObjectInputStream(new BufferedInputStream(new FileInputStream(dataFile)));
                final int version = ois.readInt();
                if ( version > 0 && version <= VERSION ) {
                    restoredData = (Map<String, EntityResourceList>)ois.readObject();
                    if ( version == VERSION ) {
                        unknownList = (List<RegisteredResource>)ois.readObject();
                    }
View Full Code Here

        public void setState(InputStream istream) {
            ObjectInputStream ois=null;
            int size=0;
            try{
               ois= new ObjectInputStream(istream);
               size = ois.readInt();
               byte []stateReceived= new byte[size];
               ois.read(stateReceived);
            }
            catch (IOException e){                        }
            finally{
View Full Code Here

    private void innerLoad(PartialLoad loaded, InputStream fis, long length, boolean latest,
            ClientContext context, RequestStarterGroup requestStarters, Random random, boolean noSerialize) throws NodeInitException, IOException {
        ObjectInputStream ois = new ObjectInputStream(fis);
        long magic = ois.readLong();
        if(magic != MAGIC) throw new IOException("Bad magic");
        int version = ois.readInt();
        if(version != VERSION) throw new IOException("Bad version");
        byte[] salt = new byte[32];
        try {
            checker.readAndChecksum(ois, salt, 0, salt.length);
            loaded.setSalt(salt);
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.