Package org.apache.wicket.util.io

Examples of org.apache.wicket.util.io.ByteArrayOutputStream


      e.printStackTrace();
    }
  }

  byte [] readAll(InputStream is) {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    try {
      byte [] buffer = new byte[4096];
      int len = 0;
      while ((len = is.read(buffer)) > -1) {
        os.write(buffer, 0, len);
      }
      return os.toByteArray();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      try {
        os.close();
        is.close();
      } catch (Exception e) {
        // ignore
      }
    }
View Full Code Here


        tw.getObjectId(id, 0);

        ObjectLoader loader = repository.open(id);
        if (FileMode.SYMLINK == mode) {
          TarArchiveEntry entry = new TarArchiveEntry(tw.getPathString(),TarArchiveEntry.LF_SYMLINK);
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          loader.copyTo(bos);
          entry.setLinkName(bos.toString());
          entry.setModTime(modified);
          tos.putArchiveEntry(entry);
          tos.closeArchiveEntry();
        } else {
          TarArchiveEntry entry = new TarArchiveEntry(tw.getPathString());
View Full Code Here

      {
        @Override
        public void writeData(final Attributes attributes)
        {
          InputStream inputStream = null;
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          try
          {
            inputStream = webExternalResourceStream.getInputStream();
            Streams.copy(inputStream, baos);
            attributes.getResponse().write(baos.toByteArray());
          }
          catch (ResourceStreamNotFoundException rsnfx)
          {
            throw new WicketRuntimeException(rsnfx);
          }
View Full Code Here

  }

  private byte[] readAllResources(List<IResourceStream> resources) throws IOException,
    ResourceStreamNotFoundException
  {
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    for (IResourceStream curStream : resources)
      IOUtils.copy(curStream.getInputStream(), output);

    byte[] bytes = output.toByteArray();

    if (getCompressor() != null)
    {
      String nonCompressed = new String(bytes, "UTF-8");
      bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8");
View Full Code Here

   *
   * @throws IOException
   */
  public SerializableChecker(NotSerializableException exception) throws IOException
  {
    this(new ByteArrayOutputStream(), exception);
  }
View Full Code Here

  }

  private byte[] readAllResources(List<IResourceStream> resources) throws IOException,
    ResourceStreamNotFoundException
  {
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    for (IResourceStream curStream : resources)
      IOUtils.copy(curStream.getInputStream(), output);
    return output.toByteArray();
  }
View Full Code Here

   *
   * @throws IOException
   */
  public SerializableChecker(NotSerializableException exception) throws IOException
  {
    this(new ByteArrayOutputStream(), exception);
  }
View Full Code Here

    {
      @Override
      public void writeData(final Attributes attributes)
      {
        InputStream inputStream = null;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try
        {
          inputStream = webExternalResourceStream.getInputStream();
          Streams.copy(inputStream, baos);
          attributes.getResponse().write(baos.toByteArray());
        }
        catch (ResourceStreamNotFoundException rsnfx)
        {
          throw new WicketRuntimeException(rsnfx);
        }
View Full Code Here

      {
        @Override
        public void writeData(final Attributes attributes)
        {
          InputStream inputStream = null;
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          try
          {
            inputStream = webExternalResourceStream.getInputStream();
            Streams.copy(inputStream, baos);
            attributes.getResponse().write(baos.toByteArray());
          }
          catch (ResourceStreamNotFoundException rsnfx)
          {
            throw new WicketRuntimeException(rsnfx);
          }
View Full Code Here

      {
        @Override
        public void writeData(final Attributes attributes)
        {
          InputStream inputStream = null;
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          try
          {
            inputStream = webExternalResourceStream.getInputStream();
            Streams.copy(inputStream, baos);
            attributes.getResponse().write(baos.toByteArray());
          }
          catch (ResourceStreamNotFoundException rsnfx)
          {
            throw new WicketRuntimeException(rsnfx);
          }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.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.