Package java.io

Examples of java.io.ByteArrayInputStream


    ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(object);
        oos.flush();
       
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
       
        return (T)ois.readObject();
  }
View Full Code Here


    }
   
    public void testEmptyCollection() throws Exception {
      ExternalizeUtil.writeCollection(oout, Arrays.asList(new Object[0]));
      oout.flush();       
        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
        ObjectInputStream oin = new ObjectInputStream(bin);
       
        List<?> result = ExternalizeUtil.readList(oin);
        assertEquals(0, result.size());
    }
View Full Code Here

        //ensure that we can serialize
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(result);
       
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);
        result = ois.readObject();
       
        ArrayList clearObject = (ArrayList)randomSymCryptor.unsealObject(result);
       
View Full Code Here

     */
    public SQLXMLImpl(final byte[] bytes) {
      super(new InputStreamFactory() {
      @Override
      public InputStream getInputStream() throws IOException {
        return new ByteArrayInputStream(bytes);
      }
    });
      setEncoding(Streamable.ENCODING);
  }
View Full Code Here

          }
        }
    }

    public static InputStream convertToInputStream(byte[] data) {
        ByteArrayInputStream bais = new ByteArrayInputStream(data);
        InputStream isContent = new BufferedInputStream(bais);
        return isContent;
    }
View Full Code Here

    /**
     * Returns the given bytes as a char array using a given encoding (null means platform default).
     */
    public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {

        return convertToCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);

    }
View Full Code Here

      setConsumerName(regInfo.getConsumerName());
      setRegistrationHandle(regInfo.getRegistrationHandle());
      byte[] bytes = regInfo.getRegistrationState();
      if (bytes != null && bytes.length > 0)
      {
         ByteArrayInputStream is = new ByteArrayInputStream(bytes);
         setRegistrationState(is);
      }

      // clear and recreate registration properties
      List<RegistrationPropertyMapping> rpms = getRegistrationProperties();
View Full Code Here

      domain.addTypeModel(ByteArrayInputStream.class);

      SerializationContext context = new SerializationContext(domain);
      try
      {
         context.write(new ByteArrayInputStream(new byte[0]));
         fail();
      }
      catch (NotSerializableException e)
      {
      }
View Full Code Here

        case Value.STRING_IGNORECASE:
            return ValueStringIgnoreCase.get(randomString(random.nextInt(100)));
        case Value.BLOB: {
            int len = (int) Math.abs(random.nextGaussian() * 10);
            byte[] data = randomBytes(len);
            return getLobStorage().createBlob(new ByteArrayInputStream(data), len);
        }
        case Value.CLOB: {
            int len = (int) Math.abs(random.nextGaussian() * 10);
            String s = randomString(len);
            return getLobStorage().createClob(new StringReader(s), len);
View Full Code Here

            return;
       
        try {
            byte[] cmapBytes = PdfReader.getStreamBytes((PRStream)PdfReader.getPdfObjectRelease(toUni));
            CMapParser cmapParser = new CMapParser();
            cmap = cmapParser.parse(new ByteArrayInputStream(cmapBytes));
        } catch (IOException e) {
            throw new Error("Unable to obtain cmap - " + e.getMessage(), e);
        }

    }
View Full Code Here

TOP

Related Classes of java.io.ByteArrayInputStream

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.