1 26 27 package it.stefanochizzolini.clown.documents.contents; 28 29 import it.stefanochizzolini.clown.bytes.IBuffer; 30 import it.stefanochizzolini.clown.documents.contents.composition.ContentBuilder; 31 import it.stefanochizzolini.clown.documents.contents.tokens.Parser; 32 import it.stefanochizzolini.clown.documents.Document; 33 import it.stefanochizzolini.clown.objects.PdfDirectObject; 34 import it.stefanochizzolini.clown.objects.PdfObjectWrapper; 35 import it.stefanochizzolini.clown.objects.PdfStream; 36 import it.stefanochizzolini.clown.util.NotImplementedException; 37 38 41 public class ContentStream 42 extends PdfObjectWrapper<PdfStream> 43 { 44 private Parser parser; 48 private IContentStreamContext streamContext; 49 51 public ContentStream( 53 Document context 54 ) 55 { 56 super( 57 context.getFile(), 58 new PdfStream() 59 ); 60 } 61 62 66 public ContentStream( 67 PdfDirectObject baseObject, 68 IContentStreamContext streamContext 69 ) 70 { 71 super( 72 baseObject, 73 null ); 75 76 this.streamContext = streamContext; 77 } 78 80 85 public void append( 86 IBuffer data 87 ) 88 {getBaseDataObject().getBody().append(data);} 89 90 public Object clone( 91 Document context 92 ) 93 {throw new NotImplementedException();} 94 95 98 public Parser getParser( 99 ) 100 { 101 if(parser == null) 102 parser = new Parser( 103 getBaseDataObject().getBody() 104 ); 105 106 return parser; 107 } 108 109 112 public IContentStreamContext getStreamContext( 113 ) 114 {return streamContext;} 115 116 119 public void insert( 120 int index, 121 IBuffer data 122 ) 123 {getBaseDataObject().getBody().insert(index,data);} 124 126 130 void setStreamContext( 131 IContentStreamContext value 132 ) 133 {streamContext = value;} 134 } | Popular Tags |