public SinglentonTextPiece( StringBuilder buffer ) throws IOException { super( 0, buffer.length(), buffer.toString().getBytes( "UTF-16LE" ), new PieceDescriptor( new byte[8], 0 ) ); }
public SinglentonTextPiece( StringBuilder buffer ) { super( 0, buffer.length(), StringUtil.getToUnicodeLE(buffer.toString()), new PieceDescriptor( new byte[8], 0 ) ); }
pieces[x] = new PieceDescriptor(node.getBytes(), 0, charset);
/** * * @param guessedCharset charset that we think this is * @return a new text piece * @throws IllegalStateException if the length isn't correct */ private TextPiece buildTextPiece(Charset guessedCharset) throws IllegalStateException { PieceDescriptor pd = new PieceDescriptor(new byte[] {0,0, 0,0,0,127, 0,0}, 0, guessedCharset); pd.setFilePosition(_fib.getFibBase().getFcMin()); // Generate a single Text Piece Table, with a single Text Piece // which covers all the (8 bit only) text in the file tpt = new OldTextPieceTable(); byte[] textData = IOUtils.safelyAllocate( _fib.getFibBase().getFcMac()-_fib.getFibBase().getFcMin(), MAX_RECORD_LENGTH); System.arraycopy(_mainStream, _fib.getFibBase().getFcMin(), textData, 0, textData.length); int numChars = textData.length; if (CodePageUtil.DOUBLE_BYTE_CHARSETS.contains(guessedCharset)) { numChars /= 2; } return new TextPiece( 0, numChars, textData, pd ); }
pieces[x] = new PieceDescriptor(node.getBytes(), 0);
pieces[x] = new PieceDescriptor( node.getBytes(), 0 );
PieceDescriptor pd = new PieceDescriptor(new byte[] {0,0, 0,0,0,127, 0,0}, 0); pd.setFilePosition(_fib.getFibBase().getFcMin());