Java 8 StringBufferInputStream - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 StringBufferInputStream class.

This code example shows how to use the following methods:read, reset, skip
	/** 
	 * @tests java.io.StringBufferInputStream#reset() 
	 */ 
	public void test_reset() { 
		// Test for method void java.io.StringBufferInputStream.reset() 
		long s = sbis.skip(6);
		assertEquals("Unable to skip correct umber of chars", 6, s);
		sbis.reset();
		assertEquals("Failed to reset", 'H', sbis.read());
	} 
 
	/** 
	 * @tests java.io.StringBufferInputStream#skip(long) 
	 */ 
	public void test_skipJ() { 
		// Test for method long java.io.StringBufferInputStream.skip(long) 
		long s = sbis.skip(6);
		assertEquals("Unable to skip correct umber of chars", 6, s);
		assertEquals("Skip positioned at incorrect char", 'W', sbis.read());
	} 
6
CodeRank
This code example shows how to use the following methods:read
 
    public void test_read$BII_Exception() { 
        // Test for method int java.io.StringBufferInputStream.read() 
        byte[] buf = new byte[10];
        try { 
            sbis.read(buf, 0, -1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {
            // Expected 
        } 
        try { 
            sbis.read(buf, -1, 1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {
            // Expected 
        } 
        try { 
            sbis.read(buf, 10, 1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {

6
CodeRank
This code example shows how to use the following methods:
                "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n"; 
 
    private VCFHeader createHeader(String headerStr) {
        VCFCodec codec = new VCFCodec();
        VCFHeader head = null;
        head = (VCFHeader) codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(headerStr))));
        return head;
    } 
 
    @Test 
    public void testHeadersWithSamplesNamesDuplicationThatIsNotAllowed() { 
        VCFHeader one = createHeader(VCF4headerStringsWithSamplesName);
        VCFHeader two = createHeader(VCF4headerStringsWithSamplesName);
        Map<String, VCFHeader> headers = new HashMap<String, VCFHeader>();
        headers.put("VCF4headerStringsWithSamplesName",one);
        headers.put("VCF4headerStringsWithSamplesName2",two);
        Assert.assertEquals(SampleUtils.verifyUniqueSamplesNames(headers),false);
    } 
 
    @Test 
6
CodeRank
This code example shows how to use the following methods:
	 
	CalendarResponse oCalRsp = null;	
 
    String sResponse = readfilestr(sUrl,"UTF-8");
 
	StringBufferInputStream oResponse = new StringBufferInputStream(sResponse);
 
    IBindingFactory bfact = BindingDirectory.getFactory(CalendarResponse.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
 
    oCalRsp = (CalendarResponse) uctx.unmarshalDocument (oResponse, "UTF-8");
 
	return oCalRsp;
  } // get 
 
} 
5
CodeRank
This code example shows how to use the following methods:read
 
    public void test_read$BII_Exception() { 
        // Test for method int java.io.StringBufferInputStream.read() 
        byte[] buf = new byte[10];
        try { 
            sbis.read(buf, 0, -1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {
            // Expected 
        } 
        try { 
            sbis.read(buf, -1, 1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {
            // Expected 
        } 
        try { 
            sbis.read(buf, 10, 1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {

5
CodeRank
This code example shows how to use the following methods:
                "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n"; 
 
    private VCFHeader createHeader(String headerStr) {
        VCFCodec codec = new VCFCodec();
        VCFHeader head = null;
        head = (VCFHeader) codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(headerStr))));
        return head;
    } 
 
    @Test
    public void testHeadersWithSamplesNamesDuplicationThatIsNotAllowed() { 
        VCFHeader one = createHeader(VCF4headerStringsWithSamplesName);
        VCFHeader two = createHeader(VCF4headerStringsWithSamplesName);
        Map<String, VCFHeader> headers = new HashMap<String, VCFHeader>();
        headers.put("VCF4headerStringsWithSamplesName",one);
        headers.put("VCF4headerStringsWithSamplesName2",two);
        Assert.assertEquals(SampleUtils.verifyUniqueSamplesNames(headers),false);
    } 
 
    @Test
5
CodeRank
This code example shows how to use the following methods:
 
    // ---- XMLTestCase methods ---- 
    private void passXMLTestCaseTest(String xml) throws Exception {
        assertXMLValid(xml);
        assertXMLValid(new InputSource(new StringReader(xml)));
        assertXMLValid(new InputSource(new StringBufferInputStream(xml)));
    } 
    private void passXMLTestCaseTest(String xml, String systemId) throws Exception {
        assertXMLValid(xml, systemId);
        assertXMLValid(new InputSource(new StringReader(xml)), systemId);
        assertXMLValid(new InputSource(new StringBufferInputStream(xml)),
                       systemId);
    } 
    private void passXMLTestCaseTest(String xml, String systemId, String doctype)
        throws Exception { 
        assertXMLValid(xml, systemId, doctype);
        assertXMLValid(new InputSource(new StringReader(xml)), systemId,
                       doctype);
        assertXMLValid(new InputSource(new StringBufferInputStream(xml)),
                       systemId, doctype);
3
CodeRank
This code example shows how to use the following methods:
    } 
    
    @SuppressWarnings("rawtypes") 
	public static Certificate getX509cert(String certstr) throws CertificateException {
    	CertificateFactory cf = CertificateFactory.getInstance("X.509");
    	Collection c = cf.generateCertificates(new StringBufferInputStream(certstr));
    	Iterator i = c.iterator();
    	while (i.hasNext()) return (Certificate)i.next();
		return null; 
    } 
        
    public static KeyStore prepNewKeyStore(KeyStore pkcskey, String pkcspass) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, IOException {
       	KeyStore newks = KeyStore.getInstance("PKCS12");
    	Certificate userCert = getUserCert(pkcskey);
    	Log.d("prepNewKeyStore","Running...");
    	Certificate interCA = null;
    	Certificate rootCA = getX509cert(TCROOT);
    	Certificate[] chain = new Certificate[3];
    	 
    	newks.load(null);
4
CodeRank
This code example shows how to use the following methods:
//		} catch (JSONException e) { 
//			e.printStackTrace(); 
//		} 
		String json = jobj.toString();
		logger.debug("Sent back to client:"+json);
		inputStream = new StringBufferInputStream(json);
		  
		return "success"; 
	} 
	public static void main(String[] args) {
	} 
	 
	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	} 
	 
	public InputStream getInputStream() {
		return inputStream;
	} 
	public void setCommand(String command) {
4
CodeRank
This code example shows how to use the following methods:
    return getContents(true); 
  } 
 
  @Override 
  public InputStream getContents(boolean force) throws CoreException {
    return new StringBufferInputStream(contents);
  } 
 
  @Override 
  public int getEncoding() throws CoreException { 
    return 0; 
  } 
 
  @Override 
  public IFileState[] getHistory(IProgressMonitor monitor) throws CoreException {
    return null; 
  } 
 
  @Override 
  public int getType() { 
4
CodeRank

Related Java 8 StringBufferInputStream Questions & Answers:

See Code Examples for Java 8 StringBufferInputStream Methods: