类java.nio.charset.MalformedInputException源码实例Demo

下面列出了怎么用java.nio.charset.MalformedInputException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Tomcat8-Source-Read   文件: TestInputBuffer.java
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    req.setCharacterEncoding("UTF-8");
    Reader r = req.getReader();

    resp.setCharacterEncoding("UTF-8");
    resp.setContentType("text/plain");
    Writer w = resp.getWriter();

    try {
        // Copy one character at a time
        int c = r.read();
        while (c != -1) {
            w.write(c);
            c = r.read();
        }
        w.close();
    } catch (MalformedInputException mie) {
        resp.resetBuffer();
        w.write("FAILED");
    }
}
 
源代码2 项目: Tomcat8-Source-Read   文件: TestB2CConverter.java
@Test
public void testBug54602c() throws Exception {
    // Check partial input is rejected once it is known to be all available
    B2CConverter conv = new B2CConverter(StandardCharsets.UTF_8);
    ByteChunk bc = new ByteChunk();
    CharChunk cc = new CharChunk();

    bc.append(UTF8_PARTIAL, 0, UTF8_PARTIAL.length);
    cc.allocate(bc.getLength(), -1);

    conv.convert(bc, cc, false);

    Exception e = null;
    try {
        conv.convert(bc, cc, true);
    } catch (MalformedInputException mie) {
        e = mie;
    }
    Assert.assertNotNull(e);
}
 
源代码3 项目: warnings-ng-plugin   文件: TaskScanner.java
/**
 * Scans the specified file for open tasks.
 *
 * @param file
 *         the file to scan
 * @param charset
 *         encoding of the file
 *
 * @return the open tasks
 */
public Report scan(final Path file, final Charset charset) {
    try (Stream<String> lines = Files.lines(file, charset)) {
        return scanTasks(lines.iterator(), new IssueBuilder().setFileName(file.toString()));
    }
    catch (IOException | UncheckedIOException exception) {
        Report report = new Report();
        Throwable cause = exception.getCause();
        if (cause instanceof MalformedInputException || cause instanceof UnmappableCharacterException) {
            report.logError("Can't read source file '%s', defined encoding '%s' seems to be wrong",
                    file, charset);
        }
        else {
            report.logException(exception, "Exception while reading the source code file '%s':", file);
        }

        return report;
    }
}
 
源代码4 项目: Tomcat7.0.67   文件: TestInputBuffer.java
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    req.setCharacterEncoding("UTF-8");
    Reader r = req.getReader();

    resp.setCharacterEncoding("UTF-8");
    resp.setContentType("text/plain");
    Writer w = resp.getWriter();

    try {
        // Copy one character at a time
        int c = r.read();
        while (c != -1) {
            w.write(c);
            c = r.read();
        }
        w.close();
    } catch (MalformedInputException mie) {
        resp.resetBuffer();
        w.write("FAILED");
    }
}
 
源代码5 项目: Tomcat7.0.67   文件: TestB2CConverter.java
@Test
public void testBug54602c() throws Exception {
    // Check partial input is rejected once it is known to be all available
    B2CConverter conv = new B2CConverter("UTF-8");
    ByteChunk bc = new ByteChunk();
    CharChunk cc = new CharChunk();

    bc.append(UTF8_PARTIAL, 0, UTF8_PARTIAL.length);
    cc.allocate(bc.getLength(), -1);

    conv.convert(bc, cc, false);

    Exception e = null;
    try {
        conv.convert(bc, cc, true);
    } catch (MalformedInputException mie) {
        e = mie;
    }
    Assert.assertNotNull(e);
}
 
源代码6 项目: hadoop   文件: TestTextNonUTF8.java
public void testNonUTF8() throws Exception{
  // this is a non UTF8 byte array
  byte b[] = {-0x01, -0x01, -0x01, -0x01, -0x01, -0x01, -0x01};
  boolean nonUTF8 = false;
  Text t = new Text(b);
  try{
    Text.validateUTF8(b);
  }catch(MalformedInputException me){
    nonUTF8 = false;
  }
  // asserting that the byte array is non utf8
  assertFalse(nonUTF8);
  byte ret[] = t.getBytes();
  // asseting that the byte array are the same when the Text
  // object is created.
  assertTrue(Arrays.equals(b, ret));
}
 
源代码7 项目: big-c   文件: TestTextNonUTF8.java
public void testNonUTF8() throws Exception{
  // this is a non UTF8 byte array
  byte b[] = {-0x01, -0x01, -0x01, -0x01, -0x01, -0x01, -0x01};
  boolean nonUTF8 = false;
  Text t = new Text(b);
  try{
    Text.validateUTF8(b);
  }catch(MalformedInputException me){
    nonUTF8 = false;
  }
  // asserting that the byte array is non utf8
  assertFalse(nonUTF8);
  byte ret[] = t.getBytes();
  // asseting that the byte array are the same when the Text
  // object is created.
  assertTrue(Arrays.equals(b, ret));
}
 
源代码8 项目: tomcatsrc   文件: TestInputBuffer.java
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    req.setCharacterEncoding("UTF-8");
    Reader r = req.getReader();

    resp.setCharacterEncoding("UTF-8");
    resp.setContentType("text/plain");
    Writer w = resp.getWriter();

    try {
        // Copy one character at a time
        int c = r.read();
        while (c != -1) {
            w.write(c);
            c = r.read();
        }
        w.close();
    } catch (MalformedInputException mie) {
        resp.resetBuffer();
        w.write("FAILED");
    }
}
 
源代码9 项目: tomcatsrc   文件: TestB2CConverter.java
@Test
public void testBug54602c() throws Exception {
    // Check partial input is rejected once it is known to be all available
    B2CConverter conv = new B2CConverter("UTF-8");
    ByteChunk bc = new ByteChunk();
    CharChunk cc = new CharChunk();

    bc.append(UTF8_PARTIAL, 0, UTF8_PARTIAL.length);
    cc.allocate(bc.getLength(), -1);

    conv.convert(bc, cc, false);

    Exception e = null;
    try {
        conv.convert(bc, cc, true);
    } catch (MalformedInputException mie) {
        e = mie;
    }
    Assert.assertNotNull(e);
}
 
源代码10 项目: Tomcat8-Source-Read   文件: TestB2CConverter.java
@Test(expected=MalformedInputException.class)
public void testBug54602a() throws Exception {
    // Check invalid input is rejected straight away
    B2CConverter conv = new B2CConverter(StandardCharsets.UTF_8);
    ByteChunk bc = new ByteChunk();
    CharChunk cc = new CharChunk();

    bc.append(UTF8_INVALID, 0, UTF8_INVALID.length);
    cc.allocate(bc.getLength(), -1);

    conv.convert(bc, cc, false);
}
 
源代码11 项目: Tomcat8-Source-Read   文件: TestB2CConverter.java
@Test(expected=MalformedInputException.class)
public void testBug54602b() throws Exception {
    // Check partial input is rejected
    B2CConverter conv = new B2CConverter(StandardCharsets.UTF_8);
    ByteChunk bc = new ByteChunk();
    CharChunk cc = new CharChunk();

    bc.append(UTF8_PARTIAL, 0, UTF8_PARTIAL.length);
    cc.allocate(bc.getLength(), -1);

    conv.convert(bc, cc, true);
}
 
源代码12 项目: jdk1.8-source-analysis   文件: CodeSetConversion.java
private void convertCharArray() {
    try {

        // Possible optimization of directly converting into the CDR buffer.
        // However, that means the CDR code would have to reserve
        // a 4 byte string length ahead of time, and we'd need a
        // confusing partial conversion scheme for when we couldn't
        // fit everything in the buffer but needed to know the
        // converted length before proceeding due to fragmentation.
        // Then there's the issue of the chunking code.
        //
        // For right now, this is less messy and basic tests don't
        // show more than a 1 ms penalty worst case.  Less than a
        // factor of 2 increase.

        // Convert the characters
        buffer = ctb.encode(CharBuffer.wrap(chars,0,numChars));

        // ByteBuffer returned by the encoder will set its limit
        // to byte immediately after the last written byte.
        numBytes = buffer.limit();

    } catch (IllegalStateException ise) {
        // an encoding operation is already in progress
        throw wrapper.ctbConverterFailure( ise ) ;
    } catch (MalformedInputException mie) {
        // There were illegal Unicode char pairs
        throw wrapper.badUnicodePair( mie ) ;
    } catch (UnmappableCharacterException uce) {
        // A character doesn't map to the desired code set
        // CORBA formal 00-11-03.
        throw omgWrapper.charNotInCodeset( uce ) ;
    } catch (CharacterCodingException cce) {
        // If this happens, then some other encoding error occured
        throw wrapper.ctbConverterFailure( cce ) ;
    }
}
 
源代码13 项目: skara   文件: AddedFileView.java
public AddedFileView(ReadOnlyRepository repo, Hash base, Hash head, List<CommitMetadata> commits, MetadataFormatter formatter, Patch patch, Path out) throws IOException {
    this.patch = patch;
    this.out = out;
    this.commits = commits;
    this.formatter = formatter;
    var path = patch.target().path().get();
    var pathInRepo = repo.root().resolve(path);
    if (patch.isTextual()) {
        binaryContent = null;
        if (head == null) {
            List<String> lines = null;
            for (var charset : List.of(StandardCharsets.UTF_8, StandardCharsets.ISO_8859_1)) {
                try {
                    lines = Files.readAllLines(pathInRepo, charset);
                    break;
                } catch (MalformedInputException e) {
                    continue;
                }
            }
            if (lines == null) {
                throw new IllegalStateException("Could not read " + pathInRepo + " as UTF-8 nor as ISO-8859-1");
            }
            newContent = lines;
        } else {
            newContent = repo.lines(path, head).orElseThrow(IllegalArgumentException::new);
        }
        stats = new WebrevStats(patch.asTextualPatch().stats(), newContent.size());
    } else {
        newContent = null;
        if (head == null) {
            binaryContent = Files.readAllBytes(pathInRepo);
        } else {
            binaryContent = repo.show(path, head).orElseThrow(IllegalArgumentException::new);
        }
        stats = WebrevStats.empty();
    }
}
 
源代码14 项目: dragonwell8_jdk   文件: StreamTest.java
private void checkMalformedInputException(Stream<String> s) {
    try {
        List<String> lines = s.collect(Collectors.toList());
        fail("UncheckedIOException expected");
    } catch (UncheckedIOException ex) {
        IOException cause = ex.getCause();
        assertTrue(cause instanceof MalformedInputException,
            "MalformedInputException expected");
    }
}
 
源代码15 项目: dragonwell8_jdk   文件: BytesAndLines.java
/**
 * Exercise Files.readAllLines(Path, Charset)
 */
public void testReadAllLines() throws IOException {
    // zero lines
    Files.write(tmpfile, new byte[0]);
    List<String> lines = Files.readAllLines(tmpfile, US_ASCII);
        assertTrue(lines.isEmpty(), "No line expected");

    // one line
    byte[] hi = { (byte)'h', (byte)'i' };
    Files.write(tmpfile, hi);
    lines = Files.readAllLines(tmpfile, US_ASCII);
    assertTrue(lines.size() == 1, "One line expected");
    assertTrue(lines.get(0).equals("hi"), "'Hi' expected");

    // two lines using platform's line separator
    List<String> expected = Arrays.asList("hi", "there");
    Files.write(tmpfile, expected, US_ASCII);
    assertTrue(Files.size(tmpfile) > 0, "File is empty");
    lines = Files.readAllLines(tmpfile, US_ASCII);
    assertTrue(lines.equals(expected), "Unexpected lines");

    // MalformedInputException
    byte[] bad = { (byte)0xff, (byte)0xff };
    Files.write(tmpfile, bad);
    try {
        Files.readAllLines(tmpfile, US_ASCII);
        fail("MalformedInputException expected");
    } catch (MalformedInputException ignore) { }
}
 
源代码16 项目: dragonwell8_jdk   文件: BytesAndLines.java
private void testReadAllLinesMalformedUTF8(byte... bytes) throws IOException {
    Files.write(tmpfile, bytes);
    try {
        Files.readAllLines(tmpfile);
        fail("MalformedInputException expected");
    } catch (MalformedInputException ignore) { }
}
 
源代码17 项目: TencentKona-8   文件: CodeSetConversion.java
private void convertCharArray() {
    try {

        // Possible optimization of directly converting into the CDR buffer.
        // However, that means the CDR code would have to reserve
        // a 4 byte string length ahead of time, and we'd need a
        // confusing partial conversion scheme for when we couldn't
        // fit everything in the buffer but needed to know the
        // converted length before proceeding due to fragmentation.
        // Then there's the issue of the chunking code.
        //
        // For right now, this is less messy and basic tests don't
        // show more than a 1 ms penalty worst case.  Less than a
        // factor of 2 increase.

        // Convert the characters
        buffer = ctb.encode(CharBuffer.wrap(chars,0,numChars));

        // ByteBuffer returned by the encoder will set its limit
        // to byte immediately after the last written byte.
        numBytes = buffer.limit();

    } catch (IllegalStateException ise) {
        // an encoding operation is already in progress
        throw wrapper.ctbConverterFailure( ise ) ;
    } catch (MalformedInputException mie) {
        // There were illegal Unicode char pairs
        throw wrapper.badUnicodePair( mie ) ;
    } catch (UnmappableCharacterException uce) {
        // A character doesn't map to the desired code set
        // CORBA formal 00-11-03.
        throw omgWrapper.charNotInCodeset( uce ) ;
    } catch (CharacterCodingException cce) {
        // If this happens, then some other encoding error occured
        throw wrapper.ctbConverterFailure( cce ) ;
    }
}
 
源代码18 项目: TencentKona-8   文件: StreamTest.java
private void checkMalformedInputException(Stream<String> s) {
    try {
        List<String> lines = s.collect(Collectors.toList());
        fail("UncheckedIOException expected");
    } catch (UncheckedIOException ex) {
        IOException cause = ex.getCause();
        assertTrue(cause instanceof MalformedInputException,
            "MalformedInputException expected");
    }
}
 
源代码19 项目: TencentKona-8   文件: BytesAndLines.java
/**
 * Exercise Files.readAllLines(Path, Charset)
 */
public void testReadAllLines() throws IOException {
    // zero lines
    Files.write(tmpfile, new byte[0]);
    List<String> lines = Files.readAllLines(tmpfile, US_ASCII);
        assertTrue(lines.isEmpty(), "No line expected");

    // one line
    byte[] hi = { (byte)'h', (byte)'i' };
    Files.write(tmpfile, hi);
    lines = Files.readAllLines(tmpfile, US_ASCII);
    assertTrue(lines.size() == 1, "One line expected");
    assertTrue(lines.get(0).equals("hi"), "'Hi' expected");

    // two lines using platform's line separator
    List<String> expected = Arrays.asList("hi", "there");
    Files.write(tmpfile, expected, US_ASCII);
    assertTrue(Files.size(tmpfile) > 0, "File is empty");
    lines = Files.readAllLines(tmpfile, US_ASCII);
    assertTrue(lines.equals(expected), "Unexpected lines");

    // MalformedInputException
    byte[] bad = { (byte)0xff, (byte)0xff };
    Files.write(tmpfile, bad);
    try {
        Files.readAllLines(tmpfile, US_ASCII);
        fail("MalformedInputException expected");
    } catch (MalformedInputException ignore) { }
}
 
源代码20 项目: TencentKona-8   文件: BytesAndLines.java
private void testReadAllLinesMalformedUTF8(byte... bytes) throws IOException {
    Files.write(tmpfile, bytes);
    try {
        Files.readAllLines(tmpfile);
        fail("MalformedInputException expected");
    } catch (MalformedInputException ignore) { }
}
 
源代码21 项目: jdk8u60   文件: CodeSetConversion.java
private void convertCharArray() {
    try {

        // Possible optimization of directly converting into the CDR buffer.
        // However, that means the CDR code would have to reserve
        // a 4 byte string length ahead of time, and we'd need a
        // confusing partial conversion scheme for when we couldn't
        // fit everything in the buffer but needed to know the
        // converted length before proceeding due to fragmentation.
        // Then there's the issue of the chunking code.
        //
        // For right now, this is less messy and basic tests don't
        // show more than a 1 ms penalty worst case.  Less than a
        // factor of 2 increase.

        // Convert the characters
        buffer = ctb.encode(CharBuffer.wrap(chars,0,numChars));

        // ByteBuffer returned by the encoder will set its limit
        // to byte immediately after the last written byte.
        numBytes = buffer.limit();

    } catch (IllegalStateException ise) {
        // an encoding operation is already in progress
        throw wrapper.ctbConverterFailure( ise ) ;
    } catch (MalformedInputException mie) {
        // There were illegal Unicode char pairs
        throw wrapper.badUnicodePair( mie ) ;
    } catch (UnmappableCharacterException uce) {
        // A character doesn't map to the desired code set
        // CORBA formal 00-11-03.
        throw omgWrapper.charNotInCodeset( uce ) ;
    } catch (CharacterCodingException cce) {
        // If this happens, then some other encoding error occured
        throw wrapper.ctbConverterFailure( cce ) ;
    }
}
 
源代码22 项目: jdk8u60   文件: StreamTest.java
private void checkMalformedInputException(Stream<String> s) {
    try {
        List<String> lines = s.collect(Collectors.toList());
        fail("UncheckedIOException expected");
    } catch (UncheckedIOException ex) {
        IOException cause = ex.getCause();
        assertTrue(cause instanceof MalformedInputException,
            "MalformedInputException expected");
    }
}
 
源代码23 项目: jdk8u60   文件: BytesAndLines.java
/**
 * Exercise Files.readAllLines(Path, Charset)
 */
public void testReadAllLines() throws IOException {
    // zero lines
    Files.write(tmpfile, new byte[0]);
    List<String> lines = Files.readAllLines(tmpfile, US_ASCII);
        assertTrue(lines.isEmpty(), "No line expected");

    // one line
    byte[] hi = { (byte)'h', (byte)'i' };
    Files.write(tmpfile, hi);
    lines = Files.readAllLines(tmpfile, US_ASCII);
    assertTrue(lines.size() == 1, "One line expected");
    assertTrue(lines.get(0).equals("hi"), "'Hi' expected");

    // two lines using platform's line separator
    List<String> expected = Arrays.asList("hi", "there");
    Files.write(tmpfile, expected, US_ASCII);
    assertTrue(Files.size(tmpfile) > 0, "File is empty");
    lines = Files.readAllLines(tmpfile, US_ASCII);
    assertTrue(lines.equals(expected), "Unexpected lines");

    // MalformedInputException
    byte[] bad = { (byte)0xff, (byte)0xff };
    Files.write(tmpfile, bad);
    try {
        Files.readAllLines(tmpfile, US_ASCII);
        fail("MalformedInputException expected");
    } catch (MalformedInputException ignore) { }
}
 
源代码24 项目: jdk8u60   文件: BytesAndLines.java
private void testReadAllLinesMalformedUTF8(byte... bytes) throws IOException {
    Files.write(tmpfile, bytes);
    try {
        Files.readAllLines(tmpfile);
        fail("MalformedInputException expected");
    } catch (MalformedInputException ignore) { }
}
 
源代码25 项目: JDKSourceCode1.8   文件: CodeSetConversion.java
private void convertCharArray() {
    try {

        // Possible optimization of directly converting into the CDR buffer.
        // However, that means the CDR code would have to reserve
        // a 4 byte string length ahead of time, and we'd need a
        // confusing partial conversion scheme for when we couldn't
        // fit everything in the buffer but needed to know the
        // converted length before proceeding due to fragmentation.
        // Then there's the issue of the chunking code.
        //
        // For right now, this is less messy and basic tests don't
        // show more than a 1 ms penalty worst case.  Less than a
        // factor of 2 increase.

        // Convert the characters
        buffer = ctb.encode(CharBuffer.wrap(chars,0,numChars));

        // ByteBuffer returned by the encoder will set its limit
        // to byte immediately after the last written byte.
        numBytes = buffer.limit();

    } catch (IllegalStateException ise) {
        // an encoding operation is already in progress
        throw wrapper.ctbConverterFailure( ise ) ;
    } catch (MalformedInputException mie) {
        // There were illegal Unicode char pairs
        throw wrapper.badUnicodePair( mie ) ;
    } catch (UnmappableCharacterException uce) {
        // A character doesn't map to the desired code set
        // CORBA formal 00-11-03.
        throw omgWrapper.charNotInCodeset( uce ) ;
    } catch (CharacterCodingException cce) {
        // If this happens, then some other encoding error occured
        throw wrapper.ctbConverterFailure( cce ) ;
    }
}
 
源代码26 项目: openjdk-jdk8u   文件: CodeSetConversion.java
private void convertCharArray() {
    try {

        // Possible optimization of directly converting into the CDR buffer.
        // However, that means the CDR code would have to reserve
        // a 4 byte string length ahead of time, and we'd need a
        // confusing partial conversion scheme for when we couldn't
        // fit everything in the buffer but needed to know the
        // converted length before proceeding due to fragmentation.
        // Then there's the issue of the chunking code.
        //
        // For right now, this is less messy and basic tests don't
        // show more than a 1 ms penalty worst case.  Less than a
        // factor of 2 increase.

        // Convert the characters
        buffer = ctb.encode(CharBuffer.wrap(chars,0,numChars));

        // ByteBuffer returned by the encoder will set its limit
        // to byte immediately after the last written byte.
        numBytes = buffer.limit();

    } catch (IllegalStateException ise) {
        // an encoding operation is already in progress
        throw wrapper.ctbConverterFailure( ise ) ;
    } catch (MalformedInputException mie) {
        // There were illegal Unicode char pairs
        throw wrapper.badUnicodePair( mie ) ;
    } catch (UnmappableCharacterException uce) {
        // A character doesn't map to the desired code set
        // CORBA formal 00-11-03.
        throw omgWrapper.charNotInCodeset( uce ) ;
    } catch (CharacterCodingException cce) {
        // If this happens, then some other encoding error occured
        throw wrapper.ctbConverterFailure( cce ) ;
    }
}
 
源代码27 项目: openjdk-jdk8u   文件: StreamTest.java
private void checkMalformedInputException(Stream<String> s) {
    try {
        List<String> lines = s.collect(Collectors.toList());
        fail("UncheckedIOException expected");
    } catch (UncheckedIOException ex) {
        IOException cause = ex.getCause();
        assertTrue(cause instanceof MalformedInputException,
            "MalformedInputException expected");
    }
}
 
源代码28 项目: openjdk-jdk8u   文件: BytesAndLines.java
/**
 * Exercise Files.readAllLines(Path, Charset)
 */
public void testReadAllLines() throws IOException {
    // zero lines
    Files.write(tmpfile, new byte[0]);
    List<String> lines = Files.readAllLines(tmpfile, US_ASCII);
        assertTrue(lines.isEmpty(), "No line expected");

    // one line
    byte[] hi = { (byte)'h', (byte)'i' };
    Files.write(tmpfile, hi);
    lines = Files.readAllLines(tmpfile, US_ASCII);
    assertTrue(lines.size() == 1, "One line expected");
    assertTrue(lines.get(0).equals("hi"), "'Hi' expected");

    // two lines using platform's line separator
    List<String> expected = Arrays.asList("hi", "there");
    Files.write(tmpfile, expected, US_ASCII);
    assertTrue(Files.size(tmpfile) > 0, "File is empty");
    lines = Files.readAllLines(tmpfile, US_ASCII);
    assertTrue(lines.equals(expected), "Unexpected lines");

    // MalformedInputException
    byte[] bad = { (byte)0xff, (byte)0xff };
    Files.write(tmpfile, bad);
    try {
        Files.readAllLines(tmpfile, US_ASCII);
        fail("MalformedInputException expected");
    } catch (MalformedInputException ignore) { }
}
 
源代码29 项目: openjdk-jdk8u   文件: BytesAndLines.java
private void testReadAllLinesMalformedUTF8(byte... bytes) throws IOException {
    Files.write(tmpfile, bytes);
    try {
        Files.readAllLines(tmpfile);
        fail("MalformedInputException expected");
    } catch (MalformedInputException ignore) { }
}
 
源代码30 项目: Tomcat7.0.67   文件: TestB2CConverter.java
@Test(expected=MalformedInputException.class)
public void testBug54602b() throws Exception {
    // Check partial input is rejected
    B2CConverter conv = new B2CConverter("UTF-8");
    ByteChunk bc = new ByteChunk();
    CharChunk cc = new CharChunk();

    bc.append(UTF8_PARTIAL, 0, UTF8_PARTIAL.length);
    cc.allocate(bc.getLength(), -1);

    conv.convert(bc, cc, true);
}