idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
5,100 | public int getNextCode ( ) { try { nextData = ( nextData << 8 ) | ( data [ bytePointer ++ ] & 0xff ) ; nextBits += 8 ; if ( nextBits < bitsToGet ) { nextData = ( nextData << 8 ) | ( data [ bytePointer ++ ] & 0xff ) ; nextBits += 8 ; } int code = ( nextData >> ( nextBits - bitsToGet ) ) & andTable [ bitsToGet - 9 ] ; ne... | Returns the next 9 10 11 or 12 bits |
5,101 | public static Set getKeySet ( Hashtable table ) { return ( table == null ) ? Collections . EMPTY_SET : table . keySet ( ) ; } | Gets the keys of a Hashtable |
5,102 | public static Object [ ] [ ] addToArray ( Object original [ ] [ ] , Object item [ ] ) { if ( original == null ) { original = new Object [ 1 ] [ ] ; original [ 0 ] = item ; return original ; } else { Object original2 [ ] [ ] = new Object [ original . length + 1 ] [ ] ; System . arraycopy ( original , 0 , original2 , 0 ,... | Utility method to extend an array . |
5,103 | public static String unEscapeURL ( String src ) { StringBuffer bf = new StringBuffer ( ) ; char [ ] s = src . toCharArray ( ) ; for ( int k = 0 ; k < s . length ; ++ k ) { char c = s [ k ] ; if ( c == '%' ) { if ( k + 2 >= s . length ) { bf . append ( c ) ; continue ; } int a0 = PRTokeniser . getHex ( s [ k + 1 ] ) ; i... | Unescapes an URL . All the %xx are replaced by the xx hex char value . |
5,104 | public static int convertToUtf32 ( String text , int idx ) { return ( ( ( text . charAt ( idx ) - 0xd800 ) * 0x400 ) + ( text . charAt ( idx + 1 ) - 0xdc00 ) ) + 0x10000 ; } | Converts a unicode character in a String to a UTF32 code point value |
5,105 | public static String getPermissionsVerbose ( int permissions ) { StringBuffer buf = new StringBuffer ( "Allowed:" ) ; if ( ( PdfWriter . ALLOW_PRINTING & permissions ) == PdfWriter . ALLOW_PRINTING ) buf . append ( " Printing" ) ; if ( ( PdfWriter . ALLOW_MODIFY_CONTENTS & permissions ) == PdfWriter . ALLOW_MODIFY_CONT... | Give you a verbose analysis of the permissions . |
5,106 | public void flateCompress ( int compressionLevel ) { if ( ! Document . compress ) return ; if ( compressed ) { return ; } this . compressionLevel = compressionLevel ; if ( inputStream != null ) { compressed = true ; return ; } PdfObject filter = PdfReader . getPdfObject ( get ( PdfName . FILTER ) ) ; if ( filter != nul... | Compresses the stream . |
5,107 | public static char decodeEntity ( String name ) { if ( name . startsWith ( "#x" ) ) { try { return ( char ) Integer . parseInt ( name . substring ( 2 ) , 16 ) ; } catch ( NumberFormatException nfe ) { return '\0' ; } } if ( name . startsWith ( "#" ) ) { try { return ( char ) Integer . parseInt ( name . substring ( 1 ) ... | Translates an entity to a unicode character . |
5,108 | int CountCharset ( int Offset , int NumofGlyphs ) { int format ; int Length = 0 ; seek ( Offset ) ; format = getCard8 ( ) ; switch ( format ) { case 0 : Length = 1 + 2 * NumofGlyphs ; break ; case 1 : Length = 1 + 3 * CountRange ( NumofGlyphs , 1 ) ; break ; case 2 : Length = 1 + 4 * CountRange ( NumofGlyphs , 2 ) ; br... | Calculates the length of the charset according to its format |
5,109 | int CountRange ( int NumofGlyphs , int Type ) { int num = 0 ; @ SuppressWarnings ( "unused" ) char Sid ; int i = 1 , nLeft ; while ( i < NumofGlyphs ) { num ++ ; Sid = getCard16 ( ) ; if ( Type == 1 ) nLeft = getCard8 ( ) ; else nLeft = getCard16 ( ) ; i += nLeft + 1 ; } return num ; } | Function calculates the number of ranges in the Charset |
5,110 | protected void readFDSelect ( int Font ) { int NumOfGlyphs = fonts [ Font ] . nglyphs ; int [ ] FDSelect = new int [ NumOfGlyphs ] ; seek ( fonts [ Font ] . fdselectOffset ) ; fonts [ Font ] . FDSelectFormat = getCard8 ( ) ; switch ( fonts [ Font ] . FDSelectFormat ) { case 0 : for ( int i = 0 ; i < NumOfGlyphs ; i ++ ... | Read the FDSelect of the font and compute the array and its length |
5,111 | protected void BuildFDArrayUsed ( int Font ) { int [ ] FDSelect = fonts [ Font ] . FDSelect ; for ( int i = 0 ; i < glyphsInList . size ( ) ; i ++ ) { int glyph = ( ( Integer ) glyphsInList . get ( i ) ) . intValue ( ) ; int FD = FDSelect [ glyph ] ; FDArrayUsed . put ( Integer . valueOf ( FD ) , null ) ; } } | Function reads the FDSelect and builds the FDArrayUsed HashMap According to the glyphs used |
5,112 | protected void ReadFDArray ( int Font ) { seek ( fonts [ Font ] . fdarrayOffset ) ; fonts [ Font ] . FDArrayCount = getCard16 ( ) ; fonts [ Font ] . FDArrayOffsize = getCard8 ( ) ; if ( fonts [ Font ] . FDArrayOffsize < 4 ) fonts [ Font ] . FDArrayOffsize ++ ; fonts [ Font ] . FDArrayOffsets = getIndex ( fonts [ Font ]... | Read the FDArray count offsize and Offset array |
5,113 | public byte [ ] Process ( String fontName ) throws IOException { try { buf . reOpen ( ) ; int j ; for ( j = 0 ; j < fonts . length ; j ++ ) if ( fontName . equals ( fonts [ j ] . name ) ) break ; if ( j == fonts . length ) return null ; if ( gsubrIndexOffset >= 0 ) GBias = CalcBias ( gsubrIndexOffset , j ) ; BuildNewCh... | The Process function extracts one font out of the CFF file and returns a subset version of the original . |
5,114 | protected int CalcBias ( int Offset , int Font ) { seek ( Offset ) ; int nSubrs = getCard16 ( ) ; if ( fonts [ Font ] . CharstringType == 1 ) return 0 ; else if ( nSubrs < 1240 ) return 107 ; else if ( nSubrs < 33900 ) return 1131 ; else return 32768 ; } | Function calcs bias according to the CharString type and the count of the subrs |
5,115 | protected void BuildNewCharString ( int FontIndex ) throws IOException { NewCharStringsIndex = BuildNewIndex ( fonts [ FontIndex ] . charstringsOffsets , GlyphsUsed , ENDCHAR_OP ) ; } | Function uses BuildNewIndex to create the new index of the subset charstrings |
5,116 | protected void BuildNewLGSubrs ( int Font ) throws IOException { if ( fonts [ Font ] . isCID ) { hSubrsUsed = new HashMap [ fonts [ Font ] . fdprivateOffsets . length ] ; lSubrsUsed = new ArrayList [ fonts [ Font ] . fdprivateOffsets . length ] ; NewLSubrsIndex = new byte [ fonts [ Font ] . fdprivateOffsets . length ] ... | Function builds the new local & global subsrs indices . IF CID then All of the FD Array lsubrs will be subsetted . |
5,117 | protected void BuildFDSubrsOffsets ( int Font , int FD ) { fonts [ Font ] . PrivateSubrsOffset [ FD ] = - 1 ; seek ( fonts [ Font ] . fdprivateOffsets [ FD ] ) ; while ( getPosition ( ) < fonts [ Font ] . fdprivateOffsets [ FD ] + fonts [ Font ] . fdprivateLengths [ FD ] ) { getDictItem ( ) ; if ( key == "Subrs" ) font... | The function finds for the FD array processed the local subr offset and its offset array . |
5,118 | protected void BuildGSubrsUsed ( int Font ) { int LBias = 0 ; int SizeOfNonCIDSubrsUsed = 0 ; if ( fonts [ Font ] . privateSubrs >= 0 ) { LBias = CalcBias ( fonts [ Font ] . privateSubrs , Font ) ; SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID . size ( ) ; } for ( int i = 0 ; i < lGSubrsUsed . size ( ) ; i ++ ) { int Subr =... | Function scans the Glsubr used ArrayList to find recursive calls to Gsubrs and adds to Hashmap & ArrayList |
5,119 | protected void HandelStack ( ) { int StackHandel = StackOpp ( ) ; if ( StackHandel < 2 ) { if ( StackHandel == 1 ) PushStack ( ) ; else { StackHandel *= - 1 ; for ( int i = 0 ; i < StackHandel ; i ++ ) PopStack ( ) ; } } else EmptyStack ( ) ; } | Function Checks how the current operator effects the run time stack after being run An operator may increase or decrease the stack size |
5,120 | protected int StackOpp ( ) { if ( key == "ifelse" ) return - 3 ; if ( key == "roll" || key == "put" ) return - 2 ; if ( key == "callsubr" || key == "callgsubr" || key == "add" || key == "sub" || key == "div" || key == "mul" || key == "drop" || key == "and" || key == "or" || key == "eq" ) return - 1 ; if ( key == "abs" ... | Function checks the key and return the change to the stack after the operator |
5,121 | protected void ReadCommand ( ) { key = null ; boolean gotKey = false ; while ( ! gotKey ) { char b0 = getCard8 ( ) ; if ( b0 == 28 ) { int first = getCard8 ( ) ; int second = getCard8 ( ) ; args [ arg_count ] = Integer . valueOf ( first << 8 | second ) ; arg_count ++ ; continue ; } if ( b0 >= 32 && b0 <= 246 ) { args [... | The function reads the next command after the file pointer is set |
5,122 | protected int CalcHints ( int begin , int end , int LBias , int GBias , int [ ] LSubrsOffsets ) { seek ( begin ) ; while ( getPosition ( ) < end ) { ReadCommand ( ) ; int pos = getPosition ( ) ; Object TopElement = null ; if ( arg_count > 0 ) TopElement = args [ arg_count - 1 ] ; int NumOfArgs = arg_count ; HandelStack... | The function reads the subroutine and returns the number of the hint in it . If a call to another subroutine is found the function calls recursively . |
5,123 | protected byte [ ] BuildNewIndex ( int [ ] Offsets , HashMap Used , byte OperatorForUnusedEntries ) throws IOException { int unusedCount = 0 ; int Offset = 0 ; int [ ] NewOffsets = new int [ Offsets . length ] ; for ( int i = 0 ; i < Offsets . length ; ++ i ) { NewOffsets [ i ] = Offset ; if ( Used . containsKey ( Inte... | Function builds the new offset array object array and assembles the index . used for creating the glyph and subrs subsetted index |
5,124 | protected byte [ ] AssembleIndex ( int [ ] NewOffsets , byte [ ] NewObjects ) { char Count = ( char ) ( NewOffsets . length - 1 ) ; int Size = NewOffsets [ NewOffsets . length - 1 ] ; byte Offsize ; if ( Size <= 0xff ) Offsize = 1 ; else if ( Size <= 0xffff ) Offsize = 2 ; else if ( Size <= 0xffffff ) Offsize = 3 ; els... | Function creates the new index inserting the count offsetsize offset array and object array . |
5,125 | protected void CopyHeader ( ) { seek ( 0 ) ; @ SuppressWarnings ( "unused" ) int major = getCard8 ( ) ; @ SuppressWarnings ( "unused" ) int minor = getCard8 ( ) ; int hdrSize = getCard8 ( ) ; @ SuppressWarnings ( "unused" ) int offSize = getCard8 ( ) ; nextIndexOffset = hdrSize ; OutputList . addLast ( new RangeItem ( ... | Function Copies the header from the original fileto the output list |
5,126 | protected void BuildIndexHeader ( int Count , int Offsize , int First ) { OutputList . addLast ( new UInt16Item ( ( char ) Count ) ) ; OutputList . addLast ( new UInt8Item ( ( char ) Offsize ) ) ; switch ( Offsize ) { case 1 : OutputList . addLast ( new UInt8Item ( ( char ) First ) ) ; break ; case 2 : OutputList . add... | Function Build the header of an index |
5,127 | protected void CreateKeys ( OffsetItem fdarrayRef , OffsetItem fdselectRef , OffsetItem charsetRef , OffsetItem charstringsRef ) { OutputList . addLast ( fdarrayRef ) ; OutputList . addLast ( new UInt8Item ( ( char ) 12 ) ) ; OutputList . addLast ( new UInt8Item ( ( char ) 36 ) ) ; OutputList . addLast ( fdselectRef ) ... | Function adds the keys into the TopDict |
5,128 | protected void CreateNewStringIndex ( int Font ) { String fdFontName = fonts [ Font ] . name + "-OneRange" ; if ( fdFontName . length ( ) > 127 ) fdFontName = fdFontName . substring ( 0 , 127 ) ; String extraStrings = "Adobe" + "Identity" + fdFontName ; int origStringsLen = stringOffsets [ stringOffsets . length - 1 ] ... | Function takes the original string item and adds the new strings to accommodate the CID rules |
5,129 | int CalcSubrOffsetSize ( int Offset , int Size ) { int OffsetSize = 0 ; seek ( Offset ) ; while ( getPosition ( ) < Offset + Size ) { int p1 = getPosition ( ) ; getDictItem ( ) ; int p2 = getPosition ( ) ; if ( key == "Subrs" ) { OffsetSize = p2 - p1 - 1 ; } } return OffsetSize ; } | Calculates how many byte it took to write the offset for the subrs in a specific private dict . |
5,130 | protected int countEntireIndexRange ( int indexOffset ) { seek ( indexOffset ) ; int count = getCard16 ( ) ; if ( count == 0 ) return 2 ; else { int indexOffSize = getCard8 ( ) ; seek ( indexOffset + 2 + 1 + count * indexOffSize ) ; int size = getOffset ( indexOffSize ) - 1 ; return 2 + 1 + ( count + 1 ) * indexOffSize... | Function computes the size of an index |
5,131 | void CreateNonCIDPrivate ( int Font , OffsetItem Subr ) { seek ( fonts [ Font ] . privateOffset ) ; while ( getPosition ( ) < fonts [ Font ] . privateOffset + fonts [ Font ] . privateLength ) { int p1 = getPosition ( ) ; getDictItem ( ) ; int p2 = getPosition ( ) ; if ( key == "Subrs" ) { OutputList . addLast ( Subr ) ... | The function creates a private dict for a font that was not CID All the keys are copied as is except for the subrs key |
5,132 | void CreateNonCIDSubrs ( int Font , IndexBaseItem PrivateBase , OffsetItem Subrs ) { OutputList . addLast ( new SubrMarkerItem ( Subrs , PrivateBase ) ) ; OutputList . addLast ( new RangeItem ( new RandomAccessFileOrArray ( NewSubrsIndexNonCID ) , 0 , NewSubrsIndexNonCID . length ) ) ; } | the function marks the beginning of the subrs index and adds the subsetted subrs index to the output list . |
5,133 | public float getWidthPoint ( ) { if ( getImage ( ) != null ) { return getImage ( ) . getScaledWidth ( ) ; } return font . getCalculatedBaseFont ( true ) . getWidthPoint ( getContent ( ) , font . getCalculatedSize ( ) ) * getHorizontalScaling ( ) ; } | Gets the width of the Chunk in points . |
5,134 | private Chunk setAttribute ( String name , Object obj ) { if ( attributes == null ) attributes = new HashMap ( ) ; attributes . put ( name , obj ) ; return this ; } | Sets an arbitrary attribute . |
5,135 | public float getHorizontalScaling ( ) { if ( attributes == null ) return 1f ; Float f = ( Float ) attributes . get ( HSCALE ) ; if ( f == null ) return 1f ; return f . floatValue ( ) ; } | Gets the horizontal scaling . |
5,136 | public Chunk setTextRenderMode ( int mode , float strokeWidth , Color strokeColor ) { return setAttribute ( TEXTRENDERMODE , new Object [ ] { Integer . valueOf ( mode ) , new Float ( strokeWidth ) , strokeColor } ) ; } | Sets the text rendering mode . It can outline text simulate bold and make text invisible . |
5,137 | public Image getImage ( ) { if ( attributes == null ) return null ; Object obj [ ] = ( Object [ ] ) attributes . get ( Chunk . IMAGE ) ; if ( obj == null ) return null ; else { return ( Image ) obj [ 0 ] ; } } | Returns the image . |
5,138 | public void decode1D ( byte [ ] buffer , byte [ ] compData , int startX , int height ) { this . data = compData ; int lineOffset = 0 ; int scanlineStride = ( w + 7 ) / 8 ; bitPointer = 0 ; bytePointer = 0 ; for ( int i = 0 ; i < height ; i ++ ) { decodeNextScanline ( buffer , lineOffset , startX ) ; lineOffset += scanl... | One - dimensional decoding methods |
5,139 | private void updatePointer ( int bitsToMoveBack ) { int i = bitPointer - bitsToMoveBack ; if ( i < 0 ) { bytePointer -- ; bitPointer = 8 + i ; } else { bitPointer = i ; } } | Move pointer backwards by given amount of bits |
5,140 | public void writeHeader ( OutputStreamCounter os ) throws IOException { if ( appendmode ) { os . write ( HEADER [ 0 ] ) ; } else { os . write ( HEADER [ 1 ] ) ; os . write ( getVersionAsByteArray ( header_version ) ) ; os . write ( HEADER [ 2 ] ) ; headerWasWritten = true ; } } | Writes the header to the OutputStreamCounter . |
5,141 | public PdfName getVersionAsName ( char version ) { switch ( version ) { case PdfWriter . VERSION_1_2 : return PdfWriter . PDF_VERSION_1_2 ; case PdfWriter . VERSION_1_3 : return PdfWriter . PDF_VERSION_1_3 ; case PdfWriter . VERSION_1_4 : return PdfWriter . PDF_VERSION_1_4 ; case PdfWriter . VERSION_1_5 : return PdfWri... | Returns the PDF version as a name . |
5,142 | public void addToCatalog ( PdfDictionary catalog ) { if ( catalog_version != null ) { catalog . put ( PdfName . VERSION , catalog_version ) ; } if ( extensions != null ) { catalog . put ( PdfName . EXTENSIONS , extensions ) ; } } | Adds the version to the Catalog dictionary . |
5,143 | public void setIsolated ( boolean isolated ) { if ( isolated ) put ( PdfName . I , PdfBoolean . PDFTRUE ) ; else remove ( PdfName . I ) ; } | Determining the initial backdrop against which its stack is composited . |
5,144 | public void setKnockout ( boolean knockout ) { if ( knockout ) put ( PdfName . K , PdfBoolean . PDFTRUE ) ; else remove ( PdfName . K ) ; } | Determining whether the objects within the stack are composited with one another or only with the group s backdrop . |
5,145 | public int getFontNumber ( RtfFont font ) { if ( font instanceof RtfParagraphStyle ) { font = new RtfFont ( this . document , font ) ; } int fontIndex = - 1 ; for ( int i = 0 ; i < fontList . size ( ) ; i ++ ) { if ( fontList . get ( i ) . equals ( font ) ) { fontIndex = i ; } } if ( fontIndex == - 1 ) { fontIndex = fo... | Gets the index of the font in the list of fonts . If the font does not exist in the list it is added . |
5,146 | public void writeDefinition ( final OutputStream result ) throws IOException { result . write ( DEFAULT_FONT ) ; result . write ( intToByteArray ( 0 ) ) ; result . write ( OPEN_GROUP ) ; result . write ( FONT_TABLE ) ; for ( int i = 0 ; i < fontList . size ( ) ; i ++ ) { result . write ( OPEN_GROUP ) ; result . write (... | Writes the definition of the font list |
5,147 | private static final int marker ( int marker ) { for ( int i = 0 ; i < VALID_MARKERS . length ; i ++ ) { if ( marker == VALID_MARKERS [ i ] ) { return VALID_MARKER ; } } for ( int i = 0 ; i < NOPARAM_MARKERS . length ; i ++ ) { if ( marker == NOPARAM_MARKERS [ i ] ) { return NOPARAM_MARKER ; } } for ( int i = 0 ; i < U... | Returns a type of marker . |
5,148 | public BaseFont awtToPdf ( Font font ) { try { BaseFontParameters p = getBaseFontParameters ( font . getFontName ( ) ) ; if ( p != null ) return BaseFont . createFont ( p . fontName , p . encoding , p . embedded , p . cached , p . ttfAfm , p . pfb ) ; String fontKey = null ; String logicalName = font . getName ( ) ; if... | Returns a BaseFont which can be used to represent the given AWT Font |
5,149 | public Font pdfToAwt ( BaseFont font , int size ) { String names [ ] [ ] = font . getFullFontName ( ) ; if ( names . length == 1 ) return new Font ( names [ 0 ] [ 3 ] , 0 , size ) ; String name10 = null ; String name3x = null ; for ( int k = 0 ; k < names . length ; ++ k ) { String name [ ] = names [ k ] ; if ( name [ ... | Returns an AWT Font which can be used to represent the given BaseFont |
5,150 | public BaseFontParameters getBaseFontParameters ( String name ) { String alias = ( String ) aliases . get ( name ) ; if ( alias == null ) return ( BaseFontParameters ) mapper . get ( name ) ; BaseFontParameters p = ( BaseFontParameters ) mapper . get ( alias ) ; if ( p == null ) return ( BaseFontParameters ) mapper . g... | Looks for a BaseFont parameter associated with a name . |
5,151 | public void insertNames ( Object allNames [ ] , String path ) { String names [ ] [ ] = ( String [ ] [ ] ) allNames [ 2 ] ; String main = null ; for ( int k = 0 ; k < names . length ; ++ k ) { String name [ ] = names [ k ] ; if ( name [ 2 ] . equals ( "1033" ) ) { main = name [ 3 ] ; break ; } } if ( main == null ) main... | Inserts the names in this map . |
5,152 | public void setPrefix ( String key , String prefix ) { PdfName fieldname = new PdfName ( key ) ; PdfObject o = get ( fieldname ) ; if ( o == null ) throw new IllegalArgumentException ( "You must set a value before adding a prefix." ) ; PdfDictionary dict = new PdfDictionary ( PdfName . COLLECTIONSUBITEM ) ; dict . put ... | Adds a prefix for the Collection item . You can only use this method after you have set the value of the item . |
5,153 | public TIFFField getField ( int tag ) { Integer i = ( Integer ) fieldIndex . get ( Integer . valueOf ( tag ) ) ; if ( i == null ) { return null ; } else { return fields [ i . intValue ( ) ] ; } } | Returns the value of a given tag as a TIFFField or null if the tag is not present . |
5,154 | public int [ ] getTags ( ) { int [ ] tags = new int [ fieldIndex . size ( ) ] ; Enumeration e = fieldIndex . keys ( ) ; int i = 0 ; while ( e . hasMoreElements ( ) ) { tags [ i ++ ] = ( ( Integer ) e . nextElement ( ) ) . intValue ( ) ; } return tags ; } | Returns an ordered array of ints indicating the tag values . |
5,155 | public byte getFieldAsByte ( int tag , int index ) { Integer i = ( Integer ) fieldIndex . get ( Integer . valueOf ( tag ) ) ; byte [ ] b = fields [ i . intValue ( ) ] . getAsBytes ( ) ; return b [ index ] ; } | Returns the value of a particular index of a given tag as a byte . The caller is responsible for ensuring that the tag is present and has type TIFFField . TIFF_SBYTE TIFF_BYTE or TIFF_UNDEFINED . |
5,156 | public long getFieldAsLong ( int tag , int index ) { Integer i = ( Integer ) fieldIndex . get ( Integer . valueOf ( tag ) ) ; return fields [ i . intValue ( ) ] . getAsLong ( index ) ; } | Returns the value of a particular index of a given tag as a long . The caller is responsible for ensuring that the tag is present and has type TIFF_BYTE TIFF_SBYTE TIFF_UNDEFINED TIFF_SHORT TIFF_SSHORT TIFF_SLONG or TIFF_LONG . |
5,157 | public String getFamilyname ( ) { String tmp = "unknown" ; switch ( getFamily ( ) ) { case Font . COURIER : return FontFactory . COURIER ; case Font . HELVETICA : return FontFactory . HELVETICA ; case Font . TIMES_ROMAN : return FontFactory . TIMES_ROMAN ; case Font . SYMBOL : return FontFactory . SYMBOL ; case Font . ... | Gets the familyname as a String . |
5,158 | public boolean canBeInObjStm ( ) { switch ( type ) { case NULL : case BOOLEAN : case NUMBER : case STRING : case NAME : case ARRAY : case DICTIONARY : return true ; case STREAM : case INDIRECT : default : return false ; } } | Whether this object can be contained in an object stream . |
5,159 | protected void init ( ) { this . codePage = new RtfCodePage ( this . document ) ; this . colorList = new RtfColorList ( this . document ) ; this . fontList = new RtfFontList ( this . document ) ; this . listTable = new RtfListTable ( this . document ) ; this . stylesheetList = new RtfStylesheetList ( this . document ) ... | initializes the RtfDocumentHeader . |
5,160 | public void writeContent ( final OutputStream result ) throws IOException { try { writeSectionDefinition ( new RtfNilOutputStream ( ) ) ; this . codePage . writeDefinition ( result ) ; this . fontList . writeDefinition ( result ) ; this . colorList . writeDefinition ( result ) ; this . stylesheetList . writeDefinition ... | Writes the contents of the document header area . |
5,161 | public void writeSectionDefinition ( final OutputStream result ) { try { RtfHeaderFooterGroup header = convertHeaderFooter ( this . header , RtfHeaderFooter . TYPE_HEADER ) ; RtfHeaderFooterGroup footer = convertHeaderFooter ( this . footer , RtfHeaderFooter . TYPE_FOOTER ) ; if ( header . hasTitlePage ( ) || footer . ... | Writes the section definition data |
5,162 | private RtfHeaderFooterGroup convertHeaderFooter ( HeaderFooter hf , int type ) { if ( hf != null ) { if ( hf instanceof RtfHeaderFooterGroup ) { return new RtfHeaderFooterGroup ( this . document , ( RtfHeaderFooterGroup ) hf , type ) ; } else if ( hf instanceof RtfHeaderFooter ) { return new RtfHeaderFooterGroup ( thi... | Converts a HeaderFooter into a RtfHeaderFooterGroup . Depending on which class the HeaderFooter is the correct RtfHeaderFooterGroup is created . |
5,163 | public void write ( final int b ) { buffer [ pos ] = ( byte ) b ; size ++ ; if ( ++ pos == buffer . length ) flushBuffer ( ) ; } | Copies the given byte to the internal buffer . |
5,164 | public void write ( final byte [ ] src ) { if ( src == null ) throw new NullPointerException ( ) ; if ( src . length < buffer . length - pos ) { System . arraycopy ( src , 0 , buffer , pos , src . length ) ; pos += src . length ; size += src . length ; return ; } writeLoop ( src , 0 , src . length ) ; } | Copies the given array to the internal buffer . |
5,165 | public void write ( final byte [ ] src , int off , int len ) { if ( src == null ) throw new NullPointerException ( ) ; if ( ( off < 0 ) || ( off > src . length ) || ( len < 0 ) || ( ( off + len ) > src . length ) || ( ( off + len ) < 0 ) ) throw new IndexOutOfBoundsException ( ) ; writeLoop ( src , off , len ) ; } | Copies len bytes starting at position off from the array src to the internal buffer . |
5,166 | public long write ( final InputStream in ) throws IOException { if ( in == null ) throw new NullPointerException ( ) ; final long sizeStart = size ; while ( true ) { final int n = in . read ( buffer , pos , buffer . length - pos ) ; if ( n < 0 ) break ; pos += n ; size += n ; if ( pos == buffer . length ) flushBuffer (... | Writes all bytes available in the given inputstream to this buffer . |
5,167 | public byte [ ] toByteArray ( ) { final byte [ ] r = new byte [ size ] ; int off = 0 ; final int n = arrays . size ( ) ; for ( int k = 0 ; k < n ; k ++ ) { byte [ ] src = ( byte [ ] ) arrays . get ( k ) ; System . arraycopy ( src , 0 , r , off , src . length ) ; off += src . length ; } if ( pos > 0 ) System . arraycopy... | Allocates a new array and copies all data that has been written to this buffer to the newly allocated array . |
5,168 | public void writeTo ( final OutputStream out ) throws IOException { if ( out == null ) throw new NullPointerException ( ) ; final int n = arrays . size ( ) ; for ( int k = 0 ; k < n ; k ++ ) { byte [ ] src = ( byte [ ] ) arrays . get ( k ) ; out . write ( src ) ; } if ( pos > 0 ) out . write ( buffer , 0 , pos ) ; } | Writes all data that has been written to this buffer to the given output stream . |
5,169 | public void characters ( char [ ] ch , int start , int length ) { if ( ignore ) return ; String content = new String ( ch , start , length ) ; if ( content . trim ( ) . length ( ) == 0 && content . indexOf ( ' ' ) < 0 ) { return ; } StringBuffer buf = new StringBuffer ( ) ; int len = content . length ( ) ; char charact... | This method gets called when characters are encountered . |
5,170 | public float getTotalLeading ( ) { float m = font == null ? Font . DEFAULTSIZE * multipliedLeading : font . getCalculatedLeading ( multipliedLeading ) ; if ( m > 0 && ! hasLeading ( ) ) { return m ; } return getLeading ( ) + m ; } | Gets the total leading . This method is based on the assumption that the font of the Paragraph is the font of all the elements that make part of the paragraph . This isn t necessarily true . |
5,171 | public void setOverPrintStroking ( boolean ov ) { put ( PdfName . OP , ov ? PdfBoolean . PDFTRUE : PdfBoolean . PDFFALSE ) ; } | Sets the flag whether to apply overprint for stroking . |
5,172 | public void setOverPrintNonStroking ( boolean ov ) { put ( PdfName . op , ov ? PdfBoolean . PDFTRUE : PdfBoolean . PDFFALSE ) ; } | Sets the flag whether to apply overprint for non stroking painting operations . |
5,173 | public void setTextKnockout ( boolean v ) { put ( PdfName . TK , v ? PdfBoolean . PDFTRUE : PdfBoolean . PDFFALSE ) ; } | Determines the behavior of overlapping glyphs within a text object in the transparent imaging model . |
5,174 | private void writeText ( String value ) { if ( this . rtfParser . isNewGroup ( ) ) { this . rtfDoc . add ( new RtfDirectContent ( "{" ) ) ; this . rtfParser . setNewGroup ( false ) ; } if ( value . length ( ) > 0 ) { this . rtfDoc . add ( new RtfDirectContent ( value ) ) ; } } | Write the string value to the destination . Used for direct content |
5,175 | public static float parseLength ( String string ) { int pos = 0 ; int length = string . length ( ) ; boolean ok = true ; while ( ok && pos < length ) { switch ( string . charAt ( pos ) ) { case '+' : case '-' : case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' :... | Parses a length . |
5,176 | public static Properties parseAttributes ( String string ) { Properties result = new Properties ( ) ; if ( string == null ) return result ; StringTokenizer keyValuePairs = new StringTokenizer ( string , ";" ) ; StringTokenizer keyValuePair ; String key ; String value ; while ( keyValuePairs . hasMoreTokens ( ) ) { keyV... | This method parses a String with attributes and returns a Properties object . |
5,177 | public static String removeComment ( String string , String startComment , String endComment ) { StringBuffer result = new StringBuffer ( ) ; int pos = 0 ; int end = endComment . length ( ) ; int start = string . indexOf ( startComment , pos ) ; while ( start > - 1 ) { result . append ( string . substring ( pos , start... | Removes the comments sections of a String . |
5,178 | PdfDictionary getDictionary ( PdfWriter writer ) { try { return PdfNumberTree . writeTree ( map , writer ) ; } catch ( IOException e ) { throw new ExceptionConverter ( e ) ; } } | Gets the page label dictionary to insert into the document . |
5,179 | public static String [ ] getPageLabels ( PdfReader reader ) { int n = reader . getNumberOfPages ( ) ; PdfDictionary dict = reader . getCatalog ( ) ; PdfDictionary labels = ( PdfDictionary ) PdfReader . getPdfObjectRelease ( dict . get ( PdfName . PAGELABELS ) ) ; if ( labels == null ) return null ; String [ ] labelstri... | Retrieves the page labels from a PDF as an array of String objects . |
5,180 | public void setToDefault ( ) { setToDefault ( COLOR ) ; setToDefault ( CHARACTER ) ; setToDefault ( PARAGRAPH ) ; setToDefault ( SECTION ) ; setToDefault ( DOCUMENT ) ; } | Set all property objects to default values . |
5,181 | public void setToDefault ( String propertyGroup ) { if ( COLOR . equals ( propertyGroup ) ) { setProperty ( COLOR_FG , new Color ( 0 , 0 , 0 ) ) ; setProperty ( COLOR_BG , new Color ( 255 , 255 , 255 ) ) ; return ; } if ( CHARACTER . equals ( propertyGroup ) ) { setProperty ( CHARACTER_BOLD , 0 ) ; setProperty ( CHARAC... | Set individual property group to default values . |
5,182 | public HashMap getProperties ( String propertyGroup ) { HashMap props = new HashMap ( ) ; for ( Map . Entry < String , Object > entry : properties . entrySet ( ) ) { String key = entry . getKey ( ) ; Object value = entry . getValue ( ) ; if ( key . startsWith ( propertyGroup ) ) { props . put ( key , value ) ; } } retu... | Get a group of properties . |
5,183 | PdfIndirectReference writePageTree ( ) throws IOException { if ( pages . isEmpty ( ) ) throw new IOException ( "The document has no pages." ) ; int leaf = 1 ; ArrayList tParents = parents ; ArrayList tPages = pages ; ArrayList nextParents = new ArrayList ( ) ; while ( true ) { leaf *= leafSize ; int stdCount = leafSize... | returns the top parent to include in the catalog |
5,184 | public static String getDigest ( String oid ) { String ret = ( String ) digestNames . get ( oid ) ; if ( ret == null ) return oid ; else return ret ; } | Gets the digest name for a certain id |
5,185 | public static String getAlgorithm ( String oid ) { String ret = ( String ) algorithmNames . get ( oid ) ; if ( ret == null ) return oid ; else return ret ; } | Gets the algorithm name for a certain id . |
5,186 | public Calendar getTimeStampDate ( ) { if ( timeStampToken == null ) return null ; Calendar cal = new GregorianCalendar ( ) ; Date date = timeStampToken . getTimeStampInfo ( ) . getGenTime ( ) ; cal . setTime ( date ) ; return cal ; } | Gets the timestamp date |
5,187 | public void update ( byte [ ] buf , int off , int len ) throws SignatureException { if ( RSAdata != null || digestAttr != null ) messageDigest . update ( buf , off , len ) ; else sig . update ( buf , off , len ) ; } | Update the digest with the specified bytes . This method is used both for signing and verifying |
5,188 | public boolean verify ( ) throws SignatureException { if ( verified ) return verifyResult ; if ( sigAttr != null ) { sig . update ( sigAttr ) ; if ( RSAdata != null ) { byte msd [ ] = messageDigest . digest ( ) ; messageDigest . update ( msd ) ; } verifyResult = ( Arrays . equals ( messageDigest . digest ( ) , digestAt... | Verify the digest . |
5,189 | public boolean verifyTimestampImprint ( ) throws NoSuchAlgorithmException { if ( timeStampToken == null ) return false ; MessageImprint imprint = timeStampToken . getTimeStampInfo ( ) . toASN1Structure ( ) . getMessageImprint ( ) ; byte [ ] md = MessageDigest . getInstance ( "SHA-1" ) . digest ( digest ) ; byte [ ] imp... | Checks if the timestamp refers to this document . |
5,190 | public String getDigestAlgorithm ( ) { String dea = getAlgorithm ( digestEncryptionAlgorithm ) ; if ( dea == null ) dea = digestEncryptionAlgorithm ; return getHashAlgorithm ( ) + "with" + dea ; } | Get the algorithm used to calculate the message digest |
5,191 | public static String verifyCertificate ( X509Certificate cert , Collection crls , Calendar calendar ) { if ( calendar == null ) calendar = new GregorianCalendar ( ) ; if ( cert . hasUnsupportedCriticalExtension ( ) ) return "Has unsupported critical extension" ; try { cert . checkValidity ( calendar . getTime ( ) ) ; }... | Verifies a single certificate . |
5,192 | public static Object [ ] verifyCertificates ( Certificate certs [ ] , KeyStore keystore , Collection crls , Calendar calendar ) { if ( calendar == null ) calendar = new GregorianCalendar ( ) ; for ( int k = 0 ; k < certs . length ; ++ k ) { X509Certificate cert = ( X509Certificate ) certs [ k ] ; String err = verifyCer... | Verifies a certificate chain against a KeyStore . |
5,193 | public static boolean verifyOcspCertificates ( BasicOCSPResp ocsp , KeyStore keystore , String provider ) { if ( provider == null ) provider = "BC" ; try { for ( Enumeration aliases = keystore . aliases ( ) ; aliases . hasMoreElements ( ) ; ) { try { String alias = ( String ) aliases . nextElement ( ) ; if ( ! keystore... | Verifies an OCSP response against a KeyStore . |
5,194 | public static boolean verifyTimestampCertificates ( TimeStampToken ts , KeyStore keystore , String provider ) { if ( provider == null ) provider = "BC" ; try { for ( Enumeration aliases = keystore . aliases ( ) ; aliases . hasMoreElements ( ) ; ) { try { String alias = ( String ) aliases . nextElement ( ) ; if ( ! keys... | Verifies a timestamp against a KeyStore . |
5,195 | public static String getOCSPURL ( X509Certificate certificate ) throws CertificateParsingException { try { ASN1Primitive obj = getExtensionValue ( certificate , Extension . authorityInfoAccess . getId ( ) ) ; if ( obj == null ) { return null ; } ASN1Sequence AccessDescriptions = ( ASN1Sequence ) obj ; for ( int i = 0 ;... | Retrieves the OCSP URL from the given certificate . |
5,196 | public boolean isRevocationValid ( ) { if ( basicResp == null ) return false ; if ( signCerts . size ( ) < 2 ) return false ; try { X509Certificate [ ] cs = ( X509Certificate [ ] ) getSignCertificateChain ( ) ; SingleResp sr = basicResp . getResponses ( ) [ 0 ] ; CertificateID cid = sr . getCertID ( ) ; X509Certificate... | Checks if OCSP revocation refers to the document signing certificate . |
5,197 | private static ASN1Primitive getIssuer ( byte [ ] enc ) { try { ASN1InputStream in = new ASN1InputStream ( new ByteArrayInputStream ( enc ) ) ; ASN1Sequence seq = ( ASN1Sequence ) in . readObject ( ) ; return ( ASN1Primitive ) seq . getObjectAt ( seq . getObjectAt ( 0 ) instanceof DERTaggedObject ? 3 : 2 ) ; } catch ( ... | Get the issuer from the TBSCertificate bytes that are passed in |
5,198 | public static X509Name getIssuerFields ( X509Certificate cert ) { try { return new X509Name ( ( ASN1Sequence ) getIssuer ( cert . getTBSCertificate ( ) ) ) ; } catch ( Exception e ) { throw new ExceptionConverter ( e ) ; } } | Get the issuer fields from an X509 Certificate |
5,199 | public static X509Name getSubjectFields ( X509Certificate cert ) { try { return new X509Name ( ( ASN1Sequence ) getSubject ( cert . getTBSCertificate ( ) ) ) ; } catch ( Exception e ) { throw new ExceptionConverter ( e ) ; } } | Get the subject fields from an X509 Certificate |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.