Package java.io

Examples of java.io.ByteArrayInputStream


    byte[] content = load(dirName, name);

    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "loadobj, after load call");

    ByteArrayInputStream bis = new ByteArrayInputStream(content);
    ObjectInputStream ois = new ObjectInputStream(bis);
    try {
      Object obj = ois.readObject();
      return obj;
    } catch (Exception e) {
      String exceptionString = e.toString();
      if (exceptionString.indexOf("KNOWN PROBLEM") == -1)
      {
          e.printStackTrace();
      }
      throw new IOException(e.getMessage());
    } finally {
      ois.close();
      bis.close();
    }
  }
View Full Code Here


        "de;GMT+01:00;EUROSPORT;Eurosport;(c) by Eurosport;;;0;\"Eurosport\"\n" +
        "de;GMT+01:00;AXN;AXN;(c) by AXN;http://www.axntv.de;;273;\"AXN\"\n" +
        "de;GMT+01:00;DMAXPUNNY;DMAX PUNNY;(c) by DMAX;http://www.dmaxtv.de/;http://sender.wannawork.de/logos/DMAX.png;257;\"Wöhnungssüche\"\n" +
        "de;GMT+01:00;EUROSPORTPUNNY;Eurosport PUNNY;(c) by Eurosport;;;0;\"Küchendißteln\"\n" +
        "de;GMT+01:00;AXNPUNNY;AXN PUNNY;(c) by AXN;http://www.axntv.de;;273;\"Älbert 獠\"",
        toString(new GZIPInputStream(new ByteArrayInputStream(stream.toByteArray()))));
  }
View Full Code Here

        try {
            MappingOutputter out = new MappingOutputter();
            StringWriter stream = new StringWriter();
            out.write(this, new PrintWriter(stream));
            MappingLoader loader = new MappingLoader();
            MappingDocument doc =  loader.loadDocument(new ByteArrayInputStream(stream.toString().getBytes()));

            // Copy the values of the instance variables.
            doc.formatted = this.formatted;
            doc.encoding = this.encoding;
            doc.name = this.name;
View Full Code Here

            return null;
        }

        byte[] data = createByteArray(this.dataLength - 4);
        buffer.readBytes(data);
    createRequestMessage(this.messageType, new NullTerminatedStringDataInputStream(new DataInputStream(new ByteArrayInputStream(data, 0, this.dataLength-4)), this.encoding));
    this.dataLength = null;
    this.messageType = null;
    return message;
  }
View Full Code Here

                }
            } else if (o instanceof String) {
                String soap = (String) o;
                try {
                    XMLStreamReader xmlReader =
                            StAXUtils.createXMLStreamReader(new ByteArrayInputStream(soap.getBytes()));
                    StAXBuilder builder = new StAXSOAPModelBuilder(xmlReader);
                    OMElement elem = builder.getDocumentElement();
                    elem.build();
                    if (elem instanceof SOAPEnvelope) {
                        SOAPEnvelope soapEnvelope = (SOAPEnvelope) elem;
View Full Code Here

   * any logging written to the appender after the invocation will not
   * be accessible through the reader.
   * @return A reader for the current buffer.
   */
  public Reader getReader() {
    return new BufferedReader(new InputStreamReader(new ByteArrayInputStream(getBuffer())));
  }
View Full Code Here

      BufferedOutputStream bos =
        new BufferedOutputStream(new FileOutputStream(tempF));
      bos.write(zip);
      bos.close();*/
     
      ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(zip));
      ZipEntry ze;
      final byte[] buff = new byte[1024];
      while ((ze = zis.getNextEntry()) != null) {
//        System.out.println("Cache: inflating " + ze.getName());
        if (ze.isDirectory()) {
View Full Code Here

            // serialize and create an input stream to read WSDL
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                if (trace()) trace.info("Serializing wsdlElement found to build an Axis2 service");
                wsdlElement.serialize(baos);
                wsdlInputStream = new ByteArrayInputStream(baos.toByteArray());
            } catch (XMLStreamException e) {
                handleException("Error converting to a StreamSource", e);
            }

            if (wsdlInputStream != null) {
View Full Code Here

        do {
          int count = read(buf, n, length - n);
          if (count < 0) throw new EOFException();
          n += count;
        } while (n < length);
        ois = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(buf)));
      } else {
        ois = new ObjectInputStream(this);
      }
     
      if (getLogger().isLoggable(BasicLevel.DEBUG))
View Full Code Here

  public void react(AgentId from, Notification not) throws Exception {
    if (not instanceof AgentCreateRequest) {
      AgentCreateRequest cnot = (AgentCreateRequest) not;
      try {
        // Restore the new agent state.
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(cnot.agentState, 0,
            cnot.agentState.length));
        Agent ag = (Agent) ois.readObject();
        try {
          ois.close();
        } catch (IOException exc) {}
View Full Code Here

TOP

Related Classes of java.io.ByteArrayInputStream

Copyright © 2015 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.