private byte[] getPlaintextStorageXml() throws Exception { ByteArrayOutputStream plaintextByteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream plaintextOutputStream = new DataOutputStream(plaintextByteArrayOutputStream); plaintextOutputStream.writeInt(transferSettings.getType().getBytes().length); plaintextOutputStream.write(transferSettings.getType().getBytes()); GZIPOutputStream plaintextGzipOutputStream = new GZIPOutputStream(plaintextOutputStream); new Persister(new Format(0)).write(transferSettings, plaintextGzipOutputStream); plaintextGzipOutputStream.close(); return plaintextByteArrayOutputStream.toByteArray(); } }
/** * This is used to acquire the <code>Style</code> for the format. * This requires that the style is not null, if a null style is * returned from the format this will break serialization. * * @return this returns the style used for this format object */ public Style getStyle() { return format.getStyle(); }
/** * This is used to determine whether the format for the current * serialization is verbose or not. The verbosity dictates the * type of default annotations that are generated for an object. * * @return this is used to determine the verbosity to use */ private boolean isAttribute() { Verbosity verbosity = format.getVerbosity(); if(verbosity != null) { return verbosity == LOW; } return false; } }
/** * Constructor for the <code>Indenter</code> object. This will * create an indent that uses the specified number of spaces to * create each entry pushed on to the stack. This uses a cache * of the specified size, which is used to optimize the object. * * @param format determines the number of spaces per indent * @param size this is the initial size of the indent cache */ private Indenter(Format format, int size) { this.indent = format.getIndent(); this.cache = new Cache(size); }
/** * Constructor for the <code>Formatter</code> object. This creates * an object that can be used to write XML in an indented format * to the specified writer. The XML written will be well formed. * * @param result this is where the XML should be written to * @param format this is the format object to use */ public Formatter(Writer result, Format format){ this.result = new BufferedWriter(result, 1024); this.indenter = new Indenter(format); this.buffer = new OutputBuffer(); this.prolog = format.getProlog(); }
/** * Constructor for the <code>Indenter</code> object. This will * create an indent that uses the specified number of spaces to * create each entry pushed on to the stack. This uses a cache * of the specified size, which is used to optimize the object. * * @param format determines the number of spaces per indent * @param size this is the initial size of the indent cache */ private Indenter(Format format, int size) { this.indent = format.getIndent(); this.cache = new Cache(size); }
/** * Constructor for the <code>Formatter</code> object. This creates * an object that can be used to write XML in an indented format * to the specified writer. The XML written will be well formed. * * @param result this is where the XML should be written to * @param format this is the format object to use */ public Formatter(Writer result, Format format){ this.result = new BufferedWriter(result, 1024); this.indenter = new Indenter(format); this.buffer = new OutputBuffer(); this.prolog = format.getProlog(); }
/** * Constructor for the <code>NodeWriter</code> object. This will * create the object that is used to control an output elements * access to the generated XML document. This keeps a stack of * active and uncommitted elements. * * @param result this is the output for the resulting document */ public NodeWriter(Writer result) { this(result, new Format()); }
/** * This is used to acquire the <code>Style</code> for the format. * This requires that the style is not null, if a null style is * returned from the format this will break serialization. * * @return this returns the style used for this format object */ public Style getStyle() { return format.getStyle(); }
/** * Constructor for the <code>Indenter</code> object. This will * create an indent that uses the specified number of spaces to * create each entry pushed on to the stack. This uses a cache * of the specified size, which is used to optimize the object. * * @param format determines the number of spaces per indent * @param size this is the initial size of the indent cache */ private Indenter(Format format, int size) { this.indent = format.getIndent(); this.cache = new Cache(size); }
/** * Constructor for the <code>Formatter</code> object. This creates * an object that can be used to write XML in an indented format * to the specified writer. The XML written will be well formed. * * @param result this is where the XML should be written to * @param format this is the format object to use */ public Formatter(Writer result, Format format){ this.result = new BufferedWriter(result, 1024); this.indenter = new Indenter(format); this.buffer = new OutputBuffer(); this.prolog = format.getProlog(); }
/** * This is used to determine whether the format for the current * serialization is verbose or not. The verbosity dictates the * type of default annotations that are generated for an object. * * @return this is used to determine the verbosity to use */ private boolean isAttribute() { Verbosity verbosity = format.getVerbosity(); if(verbosity != null) { return verbosity == LOW; } return false; } }
/** * Constructor for the <code>Support</code> object. This will * create a support object with the matcher and filter provided. * This allows the user to override the transformations that * are used to convert types to strings and back again. * * @param filter this is the filter to use with this support * @param matcher this is the matcher used for transformations */ public Support(Filter filter, Matcher matcher) { this(filter, matcher, new Format()); }
/** * This is used to acquire the <code>Style</code> for the format. * This requires that the style is not null, if a null style is * returned from the format this will break serialization. * * @return this returns the style used for this format object */ public Style getStyle() { return format.getStyle(); }
/** * This is used to determine whether the format for the current * serialization is verbose or not. The verbosity dictates the * type of default annotations that are generated for an object. * * @return this is used to determine the verbosity to use */ private boolean isAttribute() { Verbosity verbosity = format.getVerbosity(); if(verbosity != null) { return verbosity == LOW; } return false; } }
/** * Constructor for the <code>Indenter</code> object. This will * create an indent that uses three spaces for each indent that * is pushed on to the stack. This also uses a default cache * size of sixteen, which should be sufficient for most files. */ public Indenter() { this(new Format()); }
/** * Constructor for <code>EmptyExpression</code> object. This is * used to create an expression for an empty path. An empty path * is basically the root element ".". * * @param format the format used to style the paths created */ public EmptyExpression(Format format) { this.list = new LinkedList<String>(); this.style = format.getStyle(); }
/** * Constructor for the <code>Support</code> object. This will * create a support object with the matcher and filter provided. * This allows the user to override the transformations that * are used to convert types to strings and back again. * * @param filter this is the filter to use with this support * @param matcher this is the matcher used for transformations */ public Support(Filter filter, Matcher matcher) { this(filter, matcher, new Format()); }
/** * Constructor for <code>EmptyExpression</code> object. This is * used to create an expression for an empty path. An empty path * is basically the root element ".". * * @param format the format used to style the paths created */ public EmptyExpression(Format format) { this.list = new LinkedList<String>(); this.style = format.getStyle(); }
/** * Constructor for the <code>Indenter</code> object. This will * create an indent that uses three spaces for each indent that * is pushed on to the stack. This also uses a default cache * size of sixteen, which should be sufficient for most files. */ public Indenter() { this(new Format()); }