Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- readClassFile :: ByteString -> Either ClassFileError (ClassFile High)
- writeClassFile :: ClassFile High -> ByteString
- writeClassFile' :: ConstantPool Low -> ClassFile High -> ByteString
- decodeClassFile :: ByteString -> Either ClassFileError (ClassFile Low)
- encodeClassFile :: ClassFile Low -> ByteString
- evolveClassFile :: ((AttributeLocation, Text) -> Bool) -> ClassFile Low -> Either ClassFileError (ClassFile High)
- devolveClassFile :: ClassFile High -> ClassFile Low
- devolveClassFile' :: ConstantPool Low -> ClassFile High -> ClassFile Low
- roundtripCopy :: FilePath -> FilePath -> IO ()
- data Evolve a
- data ClassFileError
- data EvolveConfig = EvolveConfig {
- ecLabel :: [String]
- ecConstantPool :: ConstantPool High
- ecAttributeFilter :: (AttributeLocation, Text) -> Bool
- runEvolve :: EvolveConfig -> Evolve a -> Either ClassFileError a
- bootstrapConstantPool :: ConstantPool Low -> Either ClassFileError (ConstantPool High)
- data ConstantPoolBuilder a
- runConstantPoolBuilder :: ConstantPoolBuilder a -> CPBuilder -> (a, CPBuilder)
- data CPBuilder = CPBuilder {
- cpbMapper :: Map (Constant Low) Index
- cpbNextIndex :: Index
- cpbConstants :: [Constant Low]
- builderFromConstantPool :: ConstantPool Low -> CPBuilder
- constantPoolFromBuilder :: CPBuilder -> ConstantPool Low
- cpbEmpty :: CPBuilder
Documentation
writeClassFile :: ClassFile High -> ByteString Source #
writeClassFile' :: ConstantPool Low -> ClassFile High -> ByteString Source #
Finer granularity commands
decodeClassFile :: ByteString -> Either ClassFileError (ClassFile Low) Source #
Decode a class file from a lazy ByteString
. Ensures that the lazy
bytestring is read to EOF, and thereby closing any open files.
encodeClassFile :: ClassFile Low -> ByteString Source #
Create a lazy byte string from a class file
evolveClassFile :: ((AttributeLocation, Text) -> Bool) -> ClassFile Low -> Either ClassFileError (ClassFile High) Source #
Evolve the class file to inline the references. A filter function is provided to remove some attributes. This will sometimes give faster loading times.
devolveClassFile :: ClassFile High -> ClassFile Low Source #
Devolve a ClassFile from High to Low. This might make the ClassFile
contain
invalid attributes, since we can't read all attributes. If this this is a problem
see devolveClassFile'
.
devolveClassFile' :: ConstantPool Low -> ClassFile High -> ClassFile Low Source #
Helpers
roundtripCopy :: FilePath -> FilePath -> IO () Source #
A test function, essentially reading the classfile and then writing it to another file.
Evolve
Instances
Monad Evolve Source # | |
Functor Evolve Source # | |
Applicative Evolve Source # | |
EvolveM Evolve Source # | |
Defined in Language.JVM.ClassFileReader link :: Referenceable r => Index -> Evolve r Source # attributeFilter :: Evolve ((AttributeLocation, Text) -> Bool) Source # evolveError :: String -> Evolve r Source # | |
LabelM Evolve Source # | |
MonadReader EvolveConfig Evolve Source # | |
Defined in Language.JVM.ClassFileReader ask :: Evolve EvolveConfig # local :: (EvolveConfig -> EvolveConfig) -> Evolve a -> Evolve a # reader :: (EvolveConfig -> a) -> Evolve a # | |
MonadError ClassFileError Evolve Source # | |
Defined in Language.JVM.ClassFileReader throwError :: ClassFileError -> Evolve a # catchError :: Evolve a -> (ClassFileError -> Evolve a) -> Evolve a # |
data ClassFileError Source #
An error while reading a class file is represented using this data structure
Instances
data EvolveConfig Source #
EvolveConfig | |
|
Instances
MonadReader EvolveConfig Evolve Source # | |
Defined in Language.JVM.ClassFileReader ask :: Evolve EvolveConfig # local :: (EvolveConfig -> EvolveConfig) -> Evolve a -> Evolve a # reader :: (EvolveConfig -> a) -> Evolve a # |
runEvolve :: EvolveConfig -> Evolve a -> Either ClassFileError a Source #
bootstrapConstantPool :: ConstantPool Low -> Either ClassFileError (ConstantPool High) Source #
Untie the constant pool, this requires a special operation as the constant pool might reference itself.
Builder
data ConstantPoolBuilder a Source #
Instances
runConstantPoolBuilder :: ConstantPoolBuilder a -> CPBuilder -> (a, CPBuilder) Source #
CPBuilder | |
|
Instances
Show CPBuilder Source # | |
MonadState CPBuilder ConstantPoolBuilder Source # | |
Defined in Language.JVM.ClassFileReader get :: ConstantPoolBuilder CPBuilder # put :: CPBuilder -> ConstantPoolBuilder () # state :: (CPBuilder -> (a, CPBuilder)) -> ConstantPoolBuilder a # |