Package java.io

Examples of java.io.ByteArrayOutputStream.toByteArray()


      //
      baos.reset();
      OutputStreamWriter osw = new OutputStreamWriter(baos);
      osw.write(s);
      osw.close();
      byte[] b2 = baos.toByteArray();

      //
      List<Byte> expected = toList(b2);
      List<Byte> actual = toList(b1);
      assertEquals(expected, actual);
View Full Code Here


        for (int i = 0, length = myTypes.length; i < length; i++) {
          writeOut.writeBytes(myTypes[i].linkURL);
          writeOut.writeBytes("\n");
          writeOut.writeBytes(myTypes[i].linkText);
        }
        byte[] buffer = out.toByteArray();
        writeOut.close();

        super.javaToNative(buffer, transferData);

      } catch (IOException e) {
View Full Code Here

      if (awtImage != null) {
        final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        ImageIO.write((BufferedImage) awtImage, "png", outStream);
        final ByteArrayInputStream inStream = new ByteArrayInputStream(
            outStream.toByteArray());

        image = new Image(Display.getDefault(), inStream);
        if (!bBig) {
          image = force16height(image);
        }
View Full Code Here

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
          oos.writeObject(t);
          oos.flush();
          oos.close();
          return baos.toByteArray();
    } catch (IOException e) {
      return null;
    }
  }
 
View Full Code Here

              content_length -= len;
            }
           
            if ( baos != null ){
             
              post_is = new ByteArrayInputStream(baos.toByteArray());
             
            }else{
             
              fos.close();
             
View Full Code Here

                    null )){
                   
                keep_alive = false;
              }
             
              byte[]  head_data = head_response.toByteArray();
             
              int  header_length = head_data.length;
             
              for (int i=3;i<head_data.length;i++){
               
View Full Code Here

         
          async = true;
         
        }else{
         
          write_buffer = ByteBuffer.wrap( response.toByteArray());
        }
      }finally{
       
        if ( went_async[0] != null ){
       
View Full Code Here

  public void testLoadSave()
  {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    manager.save(out);
    System.out.println("Saved to: " + new String(out.toByteArray()));
    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    InMemoryUserManager newManager = new InMemoryUserManager(null);
    newManager.load(in);
    UserProfile profile3 = new UserProfile();
    profile3.setUserType(UserProfile.GUEST);
View Full Code Here

  public void testLoadSave()
  {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    manager.save(out);
    System.out.println("Saved to: " + new String(out.toByteArray()));
    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    InMemoryUserManager newManager = new InMemoryUserManager(null);
    newManager.load(in);
    UserProfile profile3 = new UserProfile();
    profile3.setUserType(UserProfile.GUEST);
    profile3.setUsername("user3");
View Full Code Here

        }finally{
         
          TorrentUtils.setTLSTorrentHash( null );
        }
       
        scrape_reply = message.toByteArray();
       
        Map map = BDecoder.decode( scrape_reply );
               
        boolean  this_is_az_tracker = map.get( "aztracker" ) != null;
       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.