Package java.io

Examples of java.io.StreamCorruptedException


        public void readData(InputStreamHook stream) throws IOException {
            org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
            if ((orb == null) ||
                    !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
                throw new StreamCorruptedException(
                                     "Default data must be read first");
            }
            ORBVersion clientOrbVersion =
                ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

            // Fix Date interop bug. For older versions of the ORB don't do
            // anything for readData(). Before this used to throw
            // StreamCorruptedException for older versions of the ORB where
            // calledDefaultWriteObject always returns true.
            if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
                    (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
                // XXX I18N and logging needed.
                throw new StreamCorruptedException("Default data must be read first");
            }
        }
View Full Code Here


        }

        public void beginDefaultReadObject(InputStreamHook stream) throws IOException
        {
            // XXX I18N and logging needed.
            throw new StreamCorruptedException("Default data not sent or already read/passed");
        }
View Full Code Here

            case SERIAL_PATH_END:
                if (nT < 0) {
                    break PATHDONE;
                }
                throw new StreamCorruptedException("unexpected PATH_END");

            default:
                throw new StreamCorruptedException("unrecognized path type");
            }
            needRoom(segtype != SEG_MOVETO, npoints * 2);
            if (isdbl) {
                while (--npoints >= 0) {
                    append(s.readDouble(), s.readDouble());
                }
            } else {
                while (--npoints >= 0) {
                    append(s.readFloat(), s.readFloat());
                }
            }
            pointTypes[numTypes++] = segtype;
        }
        if (nT >= 0 && s.readByte() != SERIAL_PATH_END) {
            throw new StreamCorruptedException("missing PATH_END");
        }
    }
View Full Code Here

            case JAPANESE_ERA_TYPE: return JapaneseEra.readExternal(in);
            case HIJRAH_DATE_TYPE: return HijrahDate.readExternal(in);
            case MINGUO_DATE_TYPE: return MinguoDate.readExternal(in);
            case THAIBUDDHIST_DATE_TYPE: return ThaiBuddhistDate.readExternal(in);
            case CHRONO_PERIOD_TYPE: return ChronoPeriodImpl.readExternal(in);
            default: throw new StreamCorruptedException("Unknown serialized type");
        }
    }
View Full Code Here

  case -1: // from an earlier version of the JMX API
      descriptor = ImmutableDescriptor.EMPTY_DESCRIPTOR;

      break;
  default:
      throw new StreamCorruptedException("Got unexpected byte.");
  }
    }
View Full Code Here

  case -1: // from an earlier version of the JMX API
      descriptor = ImmutableDescriptor.EMPTY_DESCRIPTOR;

      break;
  default:
      throw new StreamCorruptedException("Got unexpected byte.");
  }
    }
View Full Code Here

                        ending = false;
                        done = true;
                        break;
                    } else if (ending) {
                        logger.error("Corrupt stream, expected LF, found [0x{}]", Integer.toHexString(next));
                        throw new StreamCorruptedException("Expecting LF after CR");
                    } else {
                        sb.append((char) next);
                    }
                }
                if (!done) {
                    // let's keep the buffer and bytes read
//                    buffer.discardReadBytes();
                    buffer.markReaderIndex();
                    return null;
                }

                String[] args = lineSplit.split(sb);
                // we read the text, clear it
                sb.setLength(0);

                String cmd = args[0];
                if ("get".equals(cmd)) {
                    request = new MemcachedRestRequest(RestRequest.Method.GET, args[1], null, -1, false);
                    if (args.length > 3) {
                        request.setData(Unicode.fromStringAsBytes(args[2]));
                    }
                    return request;
                } else if ("delete".equals(cmd)) {
                    request = new MemcachedRestRequest(RestRequest.Method.DELETE, args[1], null, -1, false);
                    //                if (args.length > 3) {
                    //                    request.setData(Unicode.fromStringAsBytes(args[2]));
                    //                }
                    return request;
                } else if ("set".equals(cmd)) {
                    this.request = new MemcachedRestRequest(RestRequest.Method.POST, args[1], null, Integer.parseInt(args[4]), false);
                    buffer.markReaderIndex();
                } else if ("version".equals(cmd)) { // sent as a noop
                    byte[] bytes = Version.full().getBytes();
                    ChannelBuffer writeBuffer = ChannelBuffers.dynamicBuffer(bytes.length);
                    writeBuffer.writeBytes(bytes);
                    channel.write(writeBuffer);
                    return MemcachedDispatcher.IGNORE_REQUEST;
                } else if ("quit".equals(cmd)) {
                    if (channel.isConnected()) { // we maybe in the process of clearing the queued bits
                        channel.disconnect();
                    }
                } else {
                    logger.error("Unsupported command [{}], ignoring and closing connection", cmd);
                    if (channel.isConnected()) { // we maybe in the process of clearing the queued bits
                        channel.disconnect();
                    }
                    return null;
                }
            }
        } else {
            if (buffer.readableBytes() < (request.getDataSize() + 2)) {
                return null;
            }
            byte[] data = new byte[request.getDataSize()];
            buffer.readBytes(data, 0, data.length);
            byte next = buffer.readByte();
            if (next == CR) {
                next = buffer.readByte();
                if (next == LF) {
                    request.setData(data);
                    // reset
                    this.request = null;
                    return request;
                } else {
                    this.request = null;
                    throw new StreamCorruptedException("Expecting separator after data block");
                }
            } else {
                this.request = null;
                throw new StreamCorruptedException("Expecting separator after data block");
            }
        }
        return null;
    }
View Full Code Here

     * @param dis  the DateInputStream to load, not null
     * @throws Exception if an error occurs
     */
    private void load(DataInputStream dis) throws Exception {
        if (dis.readByte() != 1) {
            throw new StreamCorruptedException("File format not recognised");
        }
        // group
        String groupId = dis.readUTF();
        if ("TZDB".equals(groupId) == false) {
            throw new StreamCorruptedException("File format not recognised");
        }
        // versions
        int versionCount = dis.readShort();
        for (int i = 0; i < versionCount; i++) {
            versionId = dis.readUTF();
View Full Code Here

            case ZOT:
                return ZoneOffsetTransition.readExternal(in);
            case ZOTRULE:
                return ZoneOffsetTransitionRule.readExternal(in);
            default:
                throw new StreamCorruptedException("Unknown serialized type");
        }
    }
View Full Code Here

            return null;
        }

        int dataLen = buffer.getInt(buffer.readerIndex());
        if (dataLen <= 0) {
            throw new StreamCorruptedException("invalid data length: " + dataLen);
        }

        if (buffer.readableBytes() < dataLen + 4) {
            return null;
        }
View Full Code Here

TOP

Related Classes of java.io.StreamCorruptedException

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.