Package java.io

Examples of java.io.ByteArrayOutputStream


    assertEquals("AXN", list.getChannelAt(2).getName());
    assertEquals("W\u00f6hnungss\u00fcche", list.getChannelAt(3).getName());
    assertEquals("K\u00fcchendi\u00dfteln", list.getChannelAt(4).getName());
    assertEquals("\u00c4lbert \u7360", list.getChannelAt(5).getName());

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    list.writeToStream(stream);

    assertEquals("de;GMT+01:00;DMAX;DMAX;(c) by DMAX;http://www.dmaxtv.de/;http://sender.wannawork.de/logos/DMAX.png;257;\"DMAX\"\n" +
        "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


    }
   
    public static String readFile(String fileName) throws Exception {
        FileInputStream fis = new FileInputStream(UnitTestUtil.getTestDataFile(fileName));
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
       
        int c = 0;
        while ((c = fis.read()) != -1) {
            baos.write(c);
        }
       
        return baos.toString();
    }
View Full Code Here

      super(in);
      this.encoding = encoding;
    }

      public String readString() throws IOException {
          ByteArrayOutputStream buff = new ByteArrayOutputStream();
          while (true) {
              int x = read();
              if (x <= 0) {
                  break;
              }
              buff.write(x);
          }
          return new String(buff.toByteArray(), this.encoding);
      }
View Full Code Here

      tf.setOutputProperty(OutputKeys.INDENT, "yes");//$NON-NLS-1$
      tf.setOutputProperty(OutputKeys.METHOD, "xml");//$NON-NLS-1$
      tf.setOutputProperty(OutputKeys.STANDALONE, "yes");//$NON-NLS-1$
      tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); //$NON-NLS-1$ //$NON-NLS-2$
     
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      StreamResult xmlOut = new StreamResult(new BufferedOutputStream(out));
      tf.transform(xml.getSource(StreamSource.class), xmlOut);
     
      return out.toString();
    } catch (Exception e) {
      return xml.getString();
    }
  }  
View Full Code Here

    dataOut.write(b);
  }

  private void startMessage(char newMessageType) {
    this.messageType = newMessageType;
    this.outBuffer = new ByteArrayOutputStream();
    this.dataOut = new DataOutputStream(this.outBuffer);
  }
View Full Code Here

  /**
   * Create a MemoryAppender whose buffer has the given initial size.
   * @param size Initial size of buffer.
   */
  public MemoryAppender(int initSize) {
    super(new ByteArrayOutputStream(initSize));
  }
View Full Code Here

        }
       
        this.monitorInterval = client.getMonitorInterval();
        this.monitor = client.getProgressMonitor();
        this.chunk = new byte[client.getTransferBufferSize()];
        this.out = new ByteArrayOutputStream(client.getTransferBufferSize());
        this.isASCII = (client.getType().equals(FTPTransferType.ASCII));
    }
View Full Code Here

      result[current++] = new Double(Utils.missingValue());
      result[current++] = new Double(Utils.missingValue());
    }
   
    // sizes
    ByteArrayOutputStream bastream = new ByteArrayOutputStream();
    ObjectOutputStream oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(m_Classifier);
    result[current++] = new Double(bastream.size());
    bastream = new ByteArrayOutputStream();
    oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(train);
    result[current++] = new Double(bastream.size());
    bastream = new ByteArrayOutputStream();
    oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(test);
    result[current++] = new Double(bastream.size());
   
    if (m_Classifier instanceof Summarizable) {
      result[current++] = ((Summarizable)m_Classifier).toSummaryString();
    } else {
      result[current++] = null;
View Full Code Here

      result[current++] = new Double(Utils.missingValue());
      result[current++] = new Double(Utils.missingValue());
    }

    // sizes
    ByteArrayOutputStream bastream = new ByteArrayOutputStream();
    ObjectOutputStream oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(m_Classifier);
    result[current++] = new Double(bastream.size());
    bastream = new ByteArrayOutputStream();
    oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(train);
    result[current++] = new Double(bastream.size());
    bastream = new ByteArrayOutputStream();
    oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(test);
    result[current++] = new Double(bastream.size());
   
    // Prediction interval statistics
    result[current++] = new Double(eval.coverageOfTestCasesByPredictedRegions());
    result[current++] = new Double(eval.sizeOfPredictedRegions());
View Full Code Here

      result[current++] = new Double(Utils.missingValue());
      result[current++] = new Double(Utils.missingValue());
    }
   
    // sizes
    ByteArrayOutputStream bastream = new ByteArrayOutputStream();
    ObjectOutputStream oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(m_Classifier);
    result[current++] = new Double(bastream.size());
    bastream = new ByteArrayOutputStream();
    oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(train);
    result[current++] = new Double(bastream.size());
    bastream = new ByteArrayOutputStream();
    oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(test);
    result[current++] = new Double(bastream.size());
   
    // Prediction interval statistics
    result[current++] = new Double(eval.coverageOfTestCasesByPredictedRegions());
    result[current++] = new Double(eval.sizeOfPredictedRegions());
View Full Code Here

TOP

Related Classes of java.io.ByteArrayOutputStream

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.