Package java.io

Examples of java.io.StreamCorruptedException


              return null;
          }
                 
          this.dataLength = buffer.readInt();
          if (this.dataLength <= 0) {
              throw new StreamCorruptedException("invalid data length: " + this.dataLength); //$NON-NLS-1$
          }
          if (this.dataLength > this.maxObjectSize) {
              throw new StreamCorruptedException("data length too big: " + this.dataLength + " (max: " + this.maxObjectSize + ')'); //$NON-NLS-1$ //$NON-NLS-2$
          }
        }

        if (buffer.readableBytes() < this.dataLength - 4) {
            return null;
View Full Code Here


 
  static byte[] createByteArray(int length) throws StreamCorruptedException{
    try {
      return new byte[length];
    } catch(OutOfMemoryError e) {
      throw new StreamCorruptedException("data too big: " + e.getMessage()); //$NON-NLS-1$
    }
  }
View Full Code Here

              return null;
          }
 
          int dataLen = buffer.getInt(buffer.readerIndex());
          if (dataLen <= 0) {
              throw new StreamCorruptedException("invalid data length: " + dataLen);
          }
          if (dataLen > maxObjectSize) {
              throw new StreamCorruptedException(
                      "data length too big: " + dataLen + " (max: " + maxObjectSize + ')');
          }
 
          if (buffer.readableBytes() < dataLen + 4) {
              return null;
          }
 
          buffer.skipBytes(4);
          CompactObjectInputStream cois = new CompactObjectInputStream(
                  new ChannelBufferInputStream(buffer, dataLen), classLoader);
          result = cois.readObject();
          streams = ExternalizeUtil.readList(cois, StreamFactoryReference.class);
          streamIndex = 0;
      }
      while (streamIndex < streams.size()) {
        if (buffer.readableBytes() < 2) {
              return null;
          }
          int dataLen = buffer.getShort(buffer.readerIndex()) & 0xffff;
          if (buffer.readableBytes() < dataLen + 2) {
              return null;
          }
          buffer.skipBytes(2);
         
          if (stream == null) {
            store = storageManager.createFileStore("temp-stream"); //$NON-NLS-1$
            StreamFactoryReference sfr = streams.get(streamIndex);
            sfr.setStreamFactory(new FileStoreInputStreamFactory(store, Streamable.ENCODING));
            this.stream = new BufferedOutputStream(store.createOutputStream());
          }
          if (dataLen == 0) {
            stream.close();
            stream = null;
            streamIndex++;
            continue;
          }
          if (store.getLength() + dataLen > MAX_LOB_SIZE) {
            throw new StreamCorruptedException(
                      "lob too big: " + store.getLength() + dataLen + " (max: " + MAX_LOB_SIZE + ')');
          }
          buffer.readBytes(this.stream, dataLen);
      }
        Object toReturn = result;
View Full Code Here

          Blob blob = rs.getBlob(column);
          if (blob != null) {
            try {
              bytes = PGbytea.toPGString(ObjectConverterUtil.convertToByteArray(blob.getBinaryStream(), this.maxLobSize)).getBytes(this.encoding);
            } catch(OutOfMemoryError e) {
              throw new StreamCorruptedException("data too big: " + e.getMessage()); //$NON-NLS-1$
            }
          }
          break;
         
        case PG_TYPE_CHARARRAY:
View Full Code Here

    @Override
    protected void readStreamHeader() throws IOException,
            StreamCorruptedException {
        int version = readByte() & 0xFF;
        if (version != STREAM_VERSION) {
            throw new StreamCorruptedException(
                    "Unsupported version: " + version); //$NON-NLS-1$
        }
    }
View Full Code Here

        default:
          clazz = CompactObjectOutputStream.KNOWN_CODES.get(type);
          if (clazz != null) {
                return ObjectStreamClass.lookupAny(clazz);
          }
            throw new StreamCorruptedException(
                    "Unexpected class descriptor type: " + type); //$NON-NLS-1$
        }
    }
View Full Code Here

        ClassNotFoundException {
      if (result == null) {
          if (!foundLength) {
            int dataLen = findLength(4);
            if (dataLen <= 0) {
              throw new StreamCorruptedException("invalid data length: " + dataLen); //$NON-NLS-1$
          }
          if (dataLen > maxObjectSize) {
              throw new StreamCorruptedException(
                      "data length too big: " + dataLen + " (max: " + maxObjectSize + ')'); //$NON-NLS-1$ //$NON-NLS-2$
          }
          }
          fillBuffer();
          foundLength = false;
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

            //
            this.familyClusterInfo = ClusteringTargetsRepository.initTarget(this.proxyFamilyName, targets, vid);

            break;
         default:
            throw new StreamCorruptedException("Unknown version seen: " + version);
      }
     
      trace = log.isTraceEnabled();
      if(trace)
      {
View Full Code Here

                    data = dic.getData( nextCommand );
                    dic.clear();
                }
                if( data == null )
                {
                    throw new StreamCorruptedException( "Error: data is null" );
                }
                dic.visit(data);

                //log.debug( "decode - dic.getNextCode(): " + dic.getNextCode());
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.